Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actually run the tests instead of fully skipping them #659

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions examples/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import wgpu
import numpy as np

from wgpu.gui.auto import WgpuCanvas, run


# %% Entrypoints (sync and async)

Expand Down Expand Up @@ -453,21 +455,21 @@ async def draw_frame_async():
uniform_data = np.zeros((), dtype=uniform_dtype)


if __name__ == "__main__":
from wgpu.gui.auto import WgpuCanvas, run
print("Available adapters on this system:")
for a in wgpu.gpu.enumerate_adapters_sync():
print(a.summary)

print("Available adapters on this system:")
for a in wgpu.gpu.enumerate_adapters_sync():
print(a.summary)
canvas = WgpuCanvas(size=(640, 480), title="wgpu cube example")

canvas = WgpuCanvas(size=(640, 480), title="wgpu cube example")
draw_frame = setup_drawing_sync(canvas)

draw_frame = setup_drawing_sync(canvas)

def animate():
draw_frame()
canvas.request_draw()
def animate():
draw_frame()
canvas.request_draw()

canvas.request_draw(animate)

canvas.request_draw(animate)

if __name__ == "__main__":
Korijn marked this conversation as resolved.
Show resolved Hide resolved
run()
7 changes: 4 additions & 3 deletions examples/gui_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

from wgpu.gui.auto import WgpuCanvas, run

from triangle import setup_drawing_sync
# from cube import setup_drawing_sync

try:
from .triangle import setup_drawing_sync
except ImportError:
from triangle import setup_drawing_sync
Korijn marked this conversation as resolved.
Show resolved Hide resolved

canvas = WgpuCanvas(title=f"Triangle example on {WgpuCanvas.__name__}")
draw_frame = setup_drawing_sync(canvas)
Expand Down
Binary file added examples/screenshots/gui_auto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/tests/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import wgpu


ROOT = Path(__file__).parent.parent # repo root
ROOT = Path(__file__).parent.parent.parent # repo root
examples_dir = ROOT / "examples"
screenshots_dir = examples_dir / "screenshots"
diffs_dir = screenshots_dir / "diffs"
Expand Down
Loading