Browse Source

python: properly test all trade.AbstractImporter texture APIs.

Meshes, scenes, images all have this, textures not for some reason.
next
Vladimír Vondruš 2 years ago
parent
commit
6a1f1b772a
  1. 11
      src/python/magnum/test/test_trade.py

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

@ -1587,6 +1587,17 @@ class Importer(unittest.TestCase):
with self.assertRaisesRegex(RuntimeError, "import failed"): with self.assertRaisesRegex(RuntimeError, "import failed"):
importer.mesh('A broken mesh') importer.mesh('A broken mesh')
def test_texture(self):
importer = trade.ImporterManager().load_and_instantiate('GltfImporter')
importer.open_file(os.path.join(os.path.dirname(__file__), 'texture.gltf'))
self.assertEqual(importer.texture_count, 3)
self.assertEqual(importer.texture_name(1), 'A broken texture')
self.assertEqual(importer.texture_for_name('A broken texture'), 1)
texture = importer.texture(2)
self.assertEqual(texture.image, 1)
def test_texture_by_name(self): def test_texture_by_name(self):
importer = trade.ImporterManager().load_and_instantiate('GltfImporter') importer = trade.ImporterManager().load_and_instantiate('GltfImporter')
importer.open_file(os.path.join(os.path.dirname(__file__), 'texture.gltf')) importer.open_file(os.path.join(os.path.dirname(__file__), 'texture.gltf'))

Loading…
Cancel
Save