-
Notifications
You must be signed in to change notification settings - Fork 424
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
Client gametest screenshot comparison API #4381
base: 1.21.4
Are you sure you want to change the base?
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
Adds APIs to assert that a screenshot matches or contains a template image.