You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add fetch_pixel(s) method to window for unit testing. #2473
We currently don't have a concrete way to do pixel testing for unit tests. get_image doesn't play nice with the spoof window. It would hopefully be performant, but it doesn't need to be as aggressively optimized as an official screenshot interface.
Closing this, since pixel testing works in unit tests now:
arcade.get_pixel() and arcade.get_image() work with the test window. tests/unit/test_screenshot.py tests both, tests/unit/draw/test_drawing_primitives.py checks blended colors with get_pixel, and the reference-scene tests in tests/unit/rendering call get_image().
The offscreen fixture in tests/conftest.py has read_pixel, read_region, read_region_image and assert_images_almost_equal. read_pixel and read_region used to decode the bytes wrongly; Fix rand_vec_spread_deg directions, large GL reads, and pixel test helpers #2945 fixed them and added tests/unit/test_offscreen_fixture.py.
A Window method would do the same thing as arcade.get_pixel(x, y), which already reads from the current window, so we're not adding one.
Activity
einarf commentedon Dec 19, 2024
I started on this a while ago ..
pushfoo commentedon Mar 1, 2025
I have the following questions:
The
arcade.screenshotfunctionsThis file has commits from einarf in June and August of 2024, and two functions:
arcade/arcade/screenshot.py
Line 15 in 8a41838
arcade/arcade/screenshot.py
Line 38 in 8a41838
Offscreenin the top-levelconftest.pyThis class:
offscreenIt has the following methods of interest
arcade/tests/conftest.py
Line 400 in 8a41838
arcade/tests/conftest.py
Line 405 in 8a41838
arcade/tests/conftest.py
Line 415 in 8a41838
arcade/tests/conftest.py
Line 430 in 8a41838
arcade/tests/conftest.py
Line 437 in 8a41838
Fix rand_vec_spread_deg directions, large GL reads, and pixel test he…
pvcraven commentedon Oct 9, 2026
Closing this, since pixel testing works in unit tests now:
arcade.get_pixel()andarcade.get_image()work with the test window.tests/unit/test_screenshot.pytests both,tests/unit/draw/test_drawing_primitives.pychecks blended colors withget_pixel, and the reference-scene tests intests/unit/renderingcallget_image().offscreenfixture intests/conftest.pyhasread_pixel,read_region,read_region_imageandassert_images_almost_equal.read_pixelandread_regionused to decode the bytes wrongly; Fix rand_vec_spread_deg directions, large GL reads, and pixel test helpers #2945 fixed them and addedtests/unit/test_offscreen_fixture.py.A
Windowmethod would do the same thing asarcade.get_pixel(x, y), which already reads from the current window, so we're not adding one.