Skip to content

Commit

Permalink
Merge pull request #2193 from mikedh/test/viewer
Browse files Browse the repository at this point in the history
Test Viewer in CI
  • Loading branch information
mikedh authored Mar 25, 2024
2 parents 1fc240a + 98d7ed6 commit 563690a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"]
[project]
name = "trimesh"
requires-python = ">=3.7"
version = "4.2.1"
version = "4.2.2"
authors = [{name = "Michael Dawson-Haggerty", email = "[email protected]"}]
license = {file = "LICENSE.md"}
description = "Import, export, process, analyze and view triangular meshes."
Expand Down
30 changes: 30 additions & 0 deletions tests/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,36 @@ def test_viewer(self):

assert len(png) > 0

def test_methods(self):
if not g.include_rendering:
return
# set a GL config that fixes a depth buffer issue in xvfb
# this should raise an exception if pyglet can't get a library
from pyglet import gl
from pyglet.window import key

from trimesh.viewer.windowed import SceneViewer

window_conf = gl.Config(double_buffer=True, depth_size=24)

# try the various toggles we have implemented
key_check = [key.W, key.Z, key.C, key.A, key.G, key.M, key.F]

scene = g.get_mesh("cycloidal.3DXML")
scene.add_geometry(g.get_mesh("fuze.obj"))
scene.add_geometry(g.get_mesh("2D/spline.DXF"))

v = SceneViewer(scene=scene, start_loop=False, window_conf=window_conf)
v.on_draw()

# see if these do anything
for k in key_check:
v.on_key_press(symbol=k, modifiers=None)
v.on_draw()

# run the quit key toggle
v.on_key_press(symbol=key.Q, modifiers=None)


if __name__ == "__main__":
g.trimesh.util.attach_to_log()
Expand Down

0 comments on commit 563690a

Please sign in to comment.