Пример #1
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
Пример #2
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
Пример #3
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
Пример #4
0
 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))
Пример #5
0
 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))
Пример #6
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
Пример #7
0
 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))
Пример #8
0
 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))