def test_set_oversized_data(self): data = np.zeros((10, 10), dtype=np.uint8) T = Texture(data=data) T.set_data(np.ones((20, 20))) assert T.shape == (20, 20) assert T._data.shape == (20, 20) assert len(T._pending_data) == 1
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 is True assert T._need_update is 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 is False