Browse Source

python: test the remaining scenetools assertion now that we can.

next
Vladimír Vondruš 3 years ago
parent
commit
561ba51805
  1. 24
      src/python/magnum/test/test_scenetools.py

24
src/python/magnum/test/test_scenetools.py

@ -396,6 +396,24 @@ class Hierarchy(unittest.TestCase):
scenetools.absolute_field_transformations3d(scene2d, scene3d.field_id(trade.SceneField.MESH))
def test_absolute_field_transformations_no_hierarchy(self):
# TODO implement once it's possible to create / import a scene without
# the parent field
pass
# Static builds with non-static plugins cause assertions with non-owned
# array deleters used by PrimitiveImporter, skip in that case
if magnum.BUILD_STATIC:
self.skipTest("dynamic PrimitiveImporter doesn't work with a static build")
importer = trade.ImporterManager().load_and_instantiate('PrimitiveImporter')
importer.open_data(containers.ArrayView())
scene2d = scenetools.filter_except_fields(importer.scene(0), [trade.SceneField.PARENT])
scene3d = scenetools.filter_except_fields(importer.scene(1), [trade.SceneField.PARENT])
self.assertFalse(scene2d.is_3d)
self.assertFalse(scene3d.is_2d)
with self.assertRaisesRegex(AssertionError, "the scene has no hierarchy"):
scenetools.absolute_field_transformations2d(scene2d, trade.SceneField.MESH)
with self.assertRaisesRegex(AssertionError, "the scene has no hierarchy"):
scenetools.absolute_field_transformations2d(scene2d, scene2d.field_id(trade.SceneField.MESH))
with self.assertRaisesRegex(AssertionError, "the scene has no hierarchy"):
scenetools.absolute_field_transformations3d(scene3d, trade.SceneField.MESH)
with self.assertRaisesRegex(AssertionError, "the scene has no hierarchy"):
scenetools.absolute_field_transformations3d(scene3d, scene2d.field_id(trade.SceneField.MESH))

Loading…
Cancel
Save