def test_resize(self): data = np.zeros((10, 10), dtype=np.uint8) T = Texture(data=data) T.resize((5, 5)) assert T.shape == (5, 5) assert T._data.shape == (5, 5) assert T._need_resize == True assert T._need_update == False assert len(T._pending_data) == 0
def test_resize(self): data = np.zeros((10,10), dtype=np.uint8) T = Texture(data=data) T.resize((5,5)) assert T.shape == (5,5) assert T._data.shape == (5,5) assert T._need_resize == True assert T._need_update == False assert len(T._pending_data) == 0
def test_invalid_views(self): data = np.zeros((10, 10), dtype=np.uint8) T = Texture(data=data) Z = T[5:, 5:] T.resize((5, 5)) assert Z._valid == False
def test_resize_unresizeable(self): data = np.zeros((10, 10), dtype=np.uint8) T = Texture(data=data, resizeable=False) with self.assertRaises(RuntimeError): T.resize((5, 5))
def test_resize_bad_shape(self): data = np.zeros((10, 10), dtype=np.uint8) T = Texture(data=data) with self.assertRaises(ValueError): T.resize((5, 5, 5))
def test_invalid_views(self): data = np.zeros((10,10), dtype=np.uint8) T = Texture(data=data) Z = T[5:,5:] T.resize((5,5)) assert Z._valid == False
def test_resize_unresizeable(self): data = np.zeros((10,10), dtype=np.uint8) T = Texture(data=data, resizeable=False) with self.assertRaises(RuntimeError): T.resize((5,5))
def test_resize_bad_shape(self): data = np.zeros((10,10), dtype=np.uint8) T = Texture(data=data) with self.assertRaises(ValueError): T.resize((5,5,5))