Skip to content

Commit

Permalink
fix: test updated to check for color match between exported and impor…
Browse files Browse the repository at this point in the history
…ted scene
  • Loading branch information
m-agour committed May 31, 2024
1 parent 80d60aa commit 67096f5
Showing 1 changed file with 11 additions and 25 deletions.
36 changes: 11 additions & 25 deletions fury/tests/test_gltf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

from PIL import Image
from collections import Counter
import numpy as np
import numpy.testing as npt
from packaging.version import parse
Expand Down Expand Up @@ -153,39 +154,24 @@ def test_export_gltf():
focal_point=(0.0, 0.0, 0.0),
view_up=(0.0, 0.0, 1.0),
)
export_scene(scene, "test.gltf")
gltf_obj = glTF("test.gltf")
actors = gltf_obj.actors()

scene.clear()
scene.add(*actors)
display = window.snapshot(scene)
res = window.analyze_snapshot(display)
npt.assert_equal(res.objects, 1)

scene.reset_camera_tight()
scene.clear()
display_1 = window.snapshot(scene)

fetch_gltf("BoxTextured", "glTF")
filename = read_viz_gltf("BoxTextured")
gltf_obj = glTF(filename)
box_actor = gltf_obj.actors()
scene.add(*box_actor)
export_scene(scene, "test.gltf")
export_scene(scene, 'test.gltf')
scene.clear()

gltf_obj = glTF("test.gltf")
actors = gltf_obj.actors()
scene.add(*actors)

display = window.snapshot(scene)
res = window.analyze_snapshot(
display,
bg_color=(0, 0, 0),
colors=[(108, 173, 223), (92, 135, 39)],
find_objects=False,
)
npt.assert_equal(res.colors_found, [True, True])
display_2 = window.snapshot(scene)

colors_display_1 = Counter([tuple(color) for color in display_1.reshape(-1, 3)])
colors_display_2 = Counter([tuple(color) for color in display_2.reshape(-1, 3)])

is_equal_colors = colors_display_1 == colors_display_2

npt.assert_equal(is_equal_colors, True)


def test_simple_animation():
Expand Down

0 comments on commit 67096f5

Please sign in to comment.