Browse Source

python: test SceneData mutable access failures now that it's possible.

next
Vladimír Vondruš 3 years ago
parent
commit
cfaa484147
  1. 17
      src/python/magnum/test/test_trade.py

17
src/python/magnum/test/test_trade.py

@ -1001,9 +1001,20 @@ class SceneData(unittest.TestCase):
self.assertEqual(pointer[1], 0xdeadbeef) self.assertEqual(pointer[1], 0xdeadbeef)
def test_data_access_not_mutable(self): def test_data_access_not_mutable(self):
pass importer = trade.ImporterManager().load_and_instantiate('GltfImporter')
# TODO implement once there's a way to get immutable SceneData, either importer.open_file(os.path.join(os.path.dirname(__file__), 'scene.gltf'))
# by "deserializing" a binary blob or via some SceneTools API
scene = scenetools.filter_except_fields(importer.scene(0), [trade.SceneField.SKIN])
self.assertEqual(scene.data_flags, trade.DataFlags.NONE)
with self.assertRaisesRegex(AttributeError, "scene data is not mutable"):
scene.mutable_mapping(0)
with self.assertRaisesRegex(AttributeError, "scene data is not mutable"):
scene.mutable_mapping(trade.SceneField.PARENT)
with self.assertRaisesRegex(AttributeError, "scene data is not mutable"):
scene.mutable_field(0)
with self.assertRaisesRegex(AttributeError, "scene data is not mutable"):
scene.mutable_field(trade.SceneField.PARENT)
def test_field_oob(self): def test_field_oob(self):
importer = trade.ImporterManager().load_and_instantiate('GltfImporter') importer = trade.ImporterManager().load_and_instantiate('GltfImporter')

Loading…
Cancel
Save