def test_set(self): uniform = Uniform(None, "A", gl.GL_FLOAT_VEC4) uniform.set_data(1) assert (uniform.data == 1).all() uniform.set_data([1, 2, 3, 4]) assert (uniform.data == [1, 2, 3, 4]).all()
def test_set_exception(self): uniform = Uniform(None, "A", gl.GL_FLOAT_VEC4) # with self.assertRaises(ValueError): # uniform.set_data([1, 2]) self.assertRaises(ValueError, uniform.set_data, [1, 2]) # with self.assertRaises(ValueError): # uniform.set_data([1, 2, 3, 4, 5]) self.assertRaises(ValueError, uniform.set_data, [1, 2, 3, 4, 5])
def test_mat4(self): uniform = Uniform(None, "A", gl.GL_FLOAT_MAT4) assert uniform.data.dtype == np.float32 assert uniform.data.size == 16
def test_int(self): uniform = Uniform(None, "A", gl.GL_INT) assert uniform.data.dtype == np.int32 assert uniform.data.size == 1
def test_vec4(self): uniform = Uniform(None, "A", gl.GL_FLOAT_VEC2) assert uniform.data.dtype == np.float32 assert uniform.data.size == 2
def test_init(self): uniform = Uniform(None, "A", gl.GL_FLOAT) assert uniform._unit == -1