5 #include "gtest/gtest.h"
9 #include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h"
23 std::string GetTestName() {
24 std::string suite_name =
25 ::testing::UnitTest::GetInstance()->current_test_suite()->name();
26 std::string test_name =
27 ::testing::UnitTest::GetInstance()->current_test_info()->name();
29 ss <<
"impeller_" << suite_name <<
"_" << test_name;
33 std::string GetGoldenFilename() {
34 return GetTestName() +
".png";
37 bool SaveScreenshot(std::unique_ptr<Screenshot> screenshot) {
38 if (!screenshot || !screenshot->GetBytes()) {
41 std::string test_name = GetTestName();
42 std::string filename = GetGoldenFilename();
44 test_name, filename, screenshot->GetWidth(), screenshot->GetHeight());
45 return screenshot->WriteToPNG(
61 Screenshotter().GetPlayground().GetContext()->DescribeGpuModel());
67 fml::ScopedNSAutoreleasePool autorelease_pool_;
69 std::unique_ptr<MetalScreenshotter> screenshotter_;
77 {125, 125}, 125, {
Color(1.0, 0.0, 0.0, 1.0),
Color(0.0, 0.0, 1.0, 1.0)},
80 paint.stroke_width = 0.0;
88 ASSERT_TRUE(SaveScreenshot(std::move(screenshot)));