arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Add fetch_pixel(s) method to window for unit testing.

Open DragonMoffon opened this issue 1 year ago • 2 comments

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.

DragonMoffon avatar Dec 17 '24 10:12 DragonMoffon

I started on this a while ago ..

einarf avatar Dec 19 '24 11:12 einarf

I have the following questions:

  • [ ] What does "spoof window" mean here? @DragonMoffon
  • [ ] Are our windows always assumed to be RGBA buffers?
  • [ ] Will all render targets be assumed to be RGBA buffers as well?
  • [ ] @einarf When you said "I started on this", did you mean the files below?

The arcade.screenshot functions

This file has commits from einarf in June and August of 2024, and two functions:

https://github.com/pythonarcade/arcade/blob/8a41838a9dd89c8f35e89b22111936effbdd43d8/arcade/screenshot.py#L15

https://github.com/pythonarcade/arcade/blob/8a41838a9dd89c8f35e89b22111936effbdd43d8/arcade/screenshot.py#L38

Offscreen in the top-level conftest.py

This class:

  • is exposed as a top-level test fixture available in all tests via offscreen
  • was created in August of 2024 by einarf before further work by Eruvanos

It has the following methods of interest

https://github.com/pythonarcade/arcade/blob/8a41838a9dd89c8f35e89b22111936effbdd43d8/tests/conftest.py#L400

https://github.com/pythonarcade/arcade/blob/8a41838a9dd89c8f35e89b22111936effbdd43d8/tests/conftest.py#L405

https://github.com/pythonarcade/arcade/blob/8a41838a9dd89c8f35e89b22111936effbdd43d8/tests/conftest.py#L415

https://github.com/pythonarcade/arcade/blob/8a41838a9dd89c8f35e89b22111936effbdd43d8/tests/conftest.py#L430

https://github.com/pythonarcade/arcade/blob/8a41838a9dd89c8f35e89b22111936effbdd43d8/tests/conftest.py#L437

pushfoo avatar Mar 01 '25 00:03 pushfoo