Skip to content

Commit 8e594d6

Browse files
authored
[Impeller] Add an error message when failing to write golden screenshot. (flutter#50698)
So that it's easy to determine whether the playground test itself caused the failure or not.
1 parent 4503a5b commit 8e594d6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

impeller/golden_tests/golden_playground_test_mac.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,19 @@ std::string GetGoldenFilename() {
9292

9393
bool SaveScreenshot(std::unique_ptr<testing::Screenshot> screenshot) {
9494
if (!screenshot || !screenshot->GetBytes()) {
95+
FML_LOG(ERROR) << "Failed to collect screenshot for test " << GetTestName();
9596
return false;
9697
}
9798
std::string test_name = GetTestName();
9899
std::string filename = GetGoldenFilename();
99100
testing::GoldenDigest::Instance()->AddImage(
100101
test_name, filename, screenshot->GetWidth(), screenshot->GetHeight());
101-
return screenshot->WriteToPNG(
102-
testing::WorkingDirectory::Instance()->GetFilenamePath(filename));
102+
if (!screenshot->WriteToPNG(
103+
testing::WorkingDirectory::Instance()->GetFilenamePath(filename))) {
104+
FML_LOG(ERROR) << "Failed to write screenshot to " << filename;
105+
return false;
106+
}
107+
return true;
103108
}
104109

105110
bool ShouldTestHaveVulkanValidations() {

0 commit comments

Comments
 (0)