From b9fe5d10f10f659a78ba2e9c09258c68e1ebdf64 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Mon, 27 Mar 2023 16:24:53 -0700 Subject: [PATCH] Improved readme for golden tests. (flutter/engine#40679) Improved readme for impeller golden tests. --- .../src/flutter/impeller/golden_tests/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/engine/src/flutter/impeller/golden_tests/README.md b/engine/src/flutter/impeller/golden_tests/README.md index 857349f44e..6ecd6daf9a 100644 --- a/engine/src/flutter/impeller/golden_tests/README.md +++ b/engine/src/flutter/impeller/golden_tests/README.md @@ -18,3 +18,18 @@ Example invocation: Currently these tests are only supported on macOS and only test the Metal backend to Impeller. + +## Adding tests + +To add a golden image test, the `impeller_golden_tests` target must be modified +to generate the correct image and modification to its generated `digest.json`. +If a test case is added to [golden_tests.cc](./golden_tests.cc), for example +"GoldenTests.FooBar", that will turn into the golden test +"impeller_GoldenTests_Foobar" automatically if the `SaveScreenshot()` function +is used. + +The examples in `golden_tests.cc` use GLFW for rendering the tests, but +technically anything could be used. Using the `SaveScreenshot()` function will +automatically update the `GoldenDigest::Instance()` which will make sure that it +is included in the generated `digest.json`. If that function isn't used the +`GoldenDigest` should be updated manually.