14TEST(MockTextureTest, Callbacks) {
15 auto texture = std::make_shared<MockTexture>(0);
17 ASSERT_FALSE(
texture->gr_context_created());
19 ASSERT_TRUE(
texture->gr_context_created());
21 ASSERT_FALSE(
texture->gr_context_destroyed());
22 texture->OnGrContextDestroyed();
23 ASSERT_TRUE(
texture->gr_context_destroyed());
25 ASSERT_FALSE(
texture->unregistered());
26 texture->OnTextureUnregistered();
27 ASSERT_TRUE(
texture->unregistered());
30TEST(MockTextureTest, PaintCalls) {
36 auto texture = std::make_shared<MockTexture>(0, texture_image);
41 texture->Paint(context, paint_bounds1,
false, sampling);
42 texture->Paint(context, paint_bounds2,
true, sampling);
48 expected_builder.
DrawImageRect(texture_image, src1, paint_bounds1, sampling);
49 expected_builder.
DrawImageRect(texture_image, src2, paint_bounds2, sampling);
54TEST(MockTextureTest, PaintCallsWithLinearSampling) {
60 auto texture = std::make_shared<MockTexture>(0, texture_image);
65 texture->Paint(context, paint_bounds1,
false, sampling);
66 texture->Paint(context, paint_bounds2,
true, sampling);
72 expected_builder.
DrawImageRect(texture_image, src1, paint_bounds1, sampling);
73 expected_builder.
DrawImageRect(texture_image, src2, paint_bounds2, sampling);
void DrawImageRect(const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast) override
static sk_sp< DlImage > MakeTestTexture(int w, int h, int checker_size)