-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Client gametest screenshot comparison API #4381
Client gametest screenshot comparison API #4381
Conversation
* <p>Template images loaded from a path are expected to be in the {@code templates} directory inside the resources | ||
* directory of the mod which registered the gametest. If the template image is not found, and the | ||
* {@code fabric.client.gametest.testModResourcesPath} system property is set to the resources folder of the mod which | ||
* registered the gametest, then the screenshot will be saved to the {@code templates} folder so that it can be used | ||
* next time the gametest is run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if loom could set this system property by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can assume the default path and allow the user to override it in the DSL, can you open an loom issue so its not forgotten about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really good, the default algorithms look good, im glad we arent pulling in natives to do it :D
* <p>Template images loaded from a path are expected to be in the {@code templates} directory inside the resources | ||
* directory of the mod which registered the gametest. If the template image is not found, and the | ||
* {@code fabric.client.gametest.testModResourcesPath} system property is set to the resources folder of the mod which | ||
* registered the gametest, then the screenshot will be saved to the {@code templates} folder so that it can be used | ||
* next time the gametest is run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can assume the default path and allow the user to override it in the DSL, can you open an loom issue so its not forgotten about?
...client/java/net/fabricmc/fabric/impl/client/gametest/TestScreenshotComparisonAlgorithms.java
Show resolved
Hide resolved
* @param <DATA> The type of the image data array | ||
*/ | ||
@ApiStatus.NonExtendable | ||
interface RawImage<DATA> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a non-extendable interface, but are there any public APIs that create instances of it (ie can it even be used with API code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no public APIs to create instances of RawImage
, but it can be used by custom implementations of TestScreenshotComparisonAlgorithm
* Add screenshot comparison API * Cleanup and docs * Remove no-longer-needed changes to access widener (cherry picked from commit a069796)
Adds APIs to assert that a screenshot matches or contains a template image.