22 "impeller_Play_AiksTest_CanDrawPaintMultipleTimesInteractive_Metal",
23 "impeller_Play_AiksTest_CanDrawPaintMultipleTimesInteractive_Vulkan",
24 "impeller_Play_AiksTest_CanRenderLinearGradientManyColorsUnevenStops_Metal",
25 "impeller_Play_AiksTest_CanRenderLinearGradientManyColorsUnevenStops_"
27 "impeller_Play_AiksTest_CanRenderRadialGradient_Metal",
28 "impeller_Play_AiksTest_CanRenderRadialGradient_Vulkan",
29 "impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Metal",
30 "impeller_Play_AiksTest_CanRenderRadialGradientManyColors_Vulkan",
31 "impeller_Play_AiksTest_CanRenderBackdropBlurInteractive_Metal",
32 "impeller_Play_AiksTest_CanRenderBackdropBlurInteractive_Vulkan",
33 "impeller_Play_AiksTest_ClippedBlurFilterRendersCorrectlyInteractive_Metal",
34 "impeller_Play_AiksTest_ClippedBlurFilterRendersCorrectlyInteractive_"
36 "impeller_Play_AiksTest_CoverageOriginShouldBeAccountedForInSubpasses_"
38 "impeller_Play_AiksTest_CoverageOriginShouldBeAccountedForInSubpasses_"
40 "impeller_Play_AiksTest_GaussianBlurRotatedAndClippedInteractive_Metal",
41 "impeller_Play_AiksTest_GaussianBlurRotatedAndClippedInteractive_Vulkan",
42 "impeller_Play_AiksTest_GradientStrokesRenderCorrectly_Metal",
43 "impeller_Play_AiksTest_GradientStrokesRenderCorrectly_Vulkan",
44 "impeller_Play_AiksTest_ColorWheel_Metal",
45 "impeller_Play_AiksTest_ColorWheel_Vulkan",
46 "impeller_Play_AiksTest_SceneColorSource_Metal",
47 "impeller_Play_AiksTest_SceneColorSource_Vulkan",
48 "impeller_Play_AiksTest_SolidStrokesRenderCorrectly_Metal",
49 "impeller_Play_AiksTest_SolidStrokesRenderCorrectly_Vulkan",
50 "impeller_Play_AiksTest_TextFrameSubpixelAlignment_Metal",
51 "impeller_Play_AiksTest_TextFrameSubpixelAlignment_Vulkan",
54 "impeller_Play_AiksTest_TextRotated_Metal",
55 "impeller_Play_AiksTest_TextRotated_Vulkan",
59 std::string GetTestName() {
60 std::string suite_name =
61 ::testing::UnitTest::GetInstance()->current_test_suite()->name();
62 std::string test_name =
63 ::testing::UnitTest::GetInstance()->current_test_info()->name();
65 ss <<
"impeller_" << suite_name <<
"_" << test_name;
66 std::string result = ss.str();
68 std::replace(result.begin(), result.end(),
'/',
'_');
72 std::string GetGoldenFilename() {
73 return GetTestName() +
".png";
76 bool SaveScreenshot(std::unique_ptr<testing::MetalScreenshot> screenshot) {
77 if (!screenshot || !screenshot->GetBytes()) {
80 std::string test_name = GetTestName();
81 std::string filename = GetGoldenFilename();
83 test_name, filename, screenshot->GetWidth(), screenshot->GetHeight());
84 return screenshot->WriteToPNG(
103 std::shared_ptr<TypographerContext> typographer_context) {
104 typographer_context_ = std::move(typographer_context);
108 ASSERT_FALSE(dlopen(
"/usr/local/lib/libMoltenVK.dylib", RTLD_NOLOAD));
112 std::filesystem::path testing_assets_path =
113 flutter::testing::GetTestingAssetsPath();
114 std::filesystem::path target_path = testing_assets_path.parent_path()
118 std::filesystem::path icd_path = target_path /
"vk_swiftshader_icd.json";
119 setenv(
"VK_ICD_FILENAMES", icd_path.c_str(), 1);
123 GTEST_SKIP_(
"GoldenPlaygroundTest doesn't support this backend type.");
127 std::string test_name = GetTestName();
131 "GoldenPlaygroundTest doesn't support interactive playground tests "
136 "gpu_string",
GetContext()->DescribeGpuModel());
146 auto screenshot = pimpl_->screenshotter->MakeScreenshot(renderer, picture,
147 pimpl_->window_size);
148 return SaveScreenshot(std::move(screenshot));
158 const char* fixture_name,
159 bool enable_mipmapping)
const {
160 std::shared_ptr<fml::Mapping> mapping =
161 flutter::testing::OpenFixtureAsMapping(fixture_name);
165 result->SetLabel(fixture_name);
171 const char* asset_name)
const {
172 const std::shared_ptr<fml::Mapping> fixture =
173 flutter::testing::OpenFixtureAsMapping(asset_name);
174 if (!fixture || fixture->GetSize() == 0) {
181 return pimpl_->screenshotter->GetPlayground().GetContext();
185 return pimpl_->screenshotter->GetPlayground().GetContentScale();
193 return pimpl_->window_size;
196 void GoldenPlaygroundTest::GoldenPlaygroundTest::SetWindowSize(
ISize size) {
197 pimpl_->window_size = size;
201 const std::shared_ptr<Capabilities>& capabilities) {
202 return pimpl_->screenshotter->GetPlayground().SetCapabilities(capabilities);