7#include "gtest/gtest.h"
26std::string GetTestName() {
27 std::string suite_name =
28 ::testing::UnitTest::GetInstance()->current_test_suite()->name();
29 std::string test_name =
30 ::testing::UnitTest::GetInstance()->current_test_info()->name();
32 ss <<
"impeller_" << suite_name <<
"_" << test_name;
36std::string GetGoldenFilename() {
37 return GetTestName() +
".png";
40bool SaveScreenshot(std::unique_ptr<Screenshot> screenshot) {
41 if (!screenshot || !screenshot->GetBytes()) {
44 std::string test_name = GetTestName();
45 std::string filename = GetGoldenFilename();
47 test_name, filename, screenshot->GetWidth(), screenshot->GetHeight());
48 return screenshot->WriteToPNG(
52PlaygroundSwitches GetPlaygroundSwitches() {
53 PlaygroundSwitches switches;
54 switches.enable_wide_gamut =
false;
69 Screenshotter().GetPlayground().GetContext()->DescribeGpuModel());
77 std::unique_ptr<MetalScreenshotter> screenshotter_;
106 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)
MetalScreenshotter & Screenshotter()
virtual std::unique_ptr< Screenshot > MakeScreenshot(AiksContext &aiks_context, const std::shared_ptr< Texture > texture)=0
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)
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)