7#include "gtest/gtest.h"
25std::string GetTestName() {
26 std::string suite_name =
27 ::testing::UnitTest::GetInstance()->current_test_suite()->name();
28 std::string test_name =
29 ::testing::UnitTest::GetInstance()->current_test_info()->name();
31 ss <<
"impeller_" << suite_name <<
"_" << test_name;
35std::string GetGoldenFilename() {
36 return GetTestName() +
".png";
39bool SaveScreenshot(std::unique_ptr<Screenshot> screenshot) {
40 if (!screenshot || !screenshot->GetBytes()) {
43 std::string test_name = GetTestName();
44 std::string filename = GetGoldenFilename();
46 test_name, filename, screenshot->GetWidth(), screenshot->GetHeight());
47 return screenshot->WriteToPNG(
51PlaygroundSwitches GetPlaygroundSwitches() {
52 PlaygroundSwitches switches;
53 switches.enable_wide_gamut =
false;
68 Screenshotter().GetPlayground().GetContext()->DescribeGpuModel());
76 std::unique_ptr<MetalGoldenScreenshotter> screenshotter_;
105 ASSERT_TRUE(SaveScreenshot(std::move(screenshot)));
sk_sp< DisplayList > Build()
void DrawRect(const DlRect &rect, const DlPaint &paint) override
static std::shared_ptr< DlColorSource > MakeConical(DlPoint start_center, DlScalar start_radius, DlPoint end_center, DlScalar end_radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const DlMatrix *matrix=nullptr)
DlPaint & setDrawStyle(DlDrawStyle style)
DlPaint & setColorSource(std::nullptr_t source)
static GoldenDigest * Instance()
void AddDimension(const std::string &name, const std::string &value)
void AddImage(const std::string &test_name, const std::string &filename, int32_t width, int32_t height)
MetalGoldenScreenshotter & Screenshotter()
static std::unique_ptr< Screenshot > MakeScreenshot(std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
static WorkingDirectory * Instance()
@ kFill
fills interior of shapes
TEST_F(GoldenTests, ConicalGradient)
std::shared_ptr< Texture > DisplayListToTexture(const sk_sp< flutter::DisplayList > &display_list, ISize size, AiksContext &context, bool reset_host_buffer, bool generate_mips, std::optional< PixelFormat > target_pixel_format)
Render the provided display list to a texture with the given size.
static constexpr DlColor RGBA(DlScalar r, DlScalar g, DlScalar b, DlScalar a)
Construct a 32 bit color from floating point R, G, B, and A color channels.
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)