5#include "gtest/gtest.h"
9#include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h"
23std::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;
33std::string GetGoldenFilename() {
34 return GetTestName() +
".png";
37bool 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(
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)));
static ColorSource MakeConicalGradient(Point center, Scalar radius, std::vector< Color > colors, std::vector< Scalar > stops, Point focus_center, Scalar focus_radius, Entity::TileMode tile_mode, Matrix effect_transform)
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 Picture &picture, const ISize &size={300, 300}, bool scale_content=true)=0
static WorkingDirectory * Instance()
SK_API GrDirectContext * GetContext(const SkImage *src)
sk_sp< const SkPicture > picture
SK_API sk_sp< SkShader > Color(SkColor)
TEST_F(GoldenTests, ConicalGradient)
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)