Skip to content

Enable Color Distortion on test - #1553

Open
Gin890 wants to merge 4 commits into
mainfrom
distortion-on-test
Open

Gin890 wants to merge 4 commits into
mainfrom
distortion-on-test

Conversation

@Gin890

@Gin890 Gin890 commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Add color distortion to image tests to widen test coverage.

This only changes the test framework, but still requires another PR to change individual unit tests to really use the distortion feature.

Vibe coded by Claude but I've personally review each line of the code.

Design:

Create a TestImageDistortionManager to manage the distortion data asset. This is a global singleton.

The test framework will initialize that manager. For each test at runtime, the runner will query the image paths each test provides from the manager, and manager will give a list of distortions to apply on the given images.

Each unit test will need to call a image color distortion function to apply each given distortion onto its loaded image, internally.

Gin and others added 4 commits October 10, 2026 17:41
Create a distortion manager class singleton to load
image capture card distortion setting from the test repo.
This class will then work with the rest of the test framework
to apply color distortions to test images

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gin890 Gin890 mentioned this pull request Oct 11, 2026
// `UNIT_TEST_RESOURCE_PATH()`, e.g. "NintendoSwitch/UpdateMenuDetector/English_1_True.png".
// This is useful for tracking and managing image assets at runtime along with applying the
// correct image distortion to augment test coverage.
virtual std::vector<std::string> image_paths() const{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This UnitTest file is not the right place to put specific stuff like image distortions. This is a generic API and we shouldn't be adding test-specific plugs into it.

Is there another way to architect this? Like just a helper function that takes a ImageViewRGB32 and returns a brand new ImageRGB32 with the distortions? Then we plug it into the call sites? Because your follow up PR is already just as invasive in touching all the call sites.

@@ -24,6 +24,10 @@ namespace PokemonAutomation{
class UnitTestRunner final : public CancellableScope{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing with these two files. Test-specific stuff like image distortions should not be leaking into the generic test API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants