5#include "flutter/flow/layers/clip_rect_layer.h"
6#include "flutter/flow/layers/platform_view_layer.h"
7#include "flutter/flow/layers/transform_layer.h"
9#include "flutter/flow/testing/layer_test.h"
10#include "flutter/flow/testing/mock_embedder.h"
11#include "flutter/flow/testing/mock_layer.h"
12#include "flutter/fml/macros.h"
13#include "flutter/testing/mock_canvas.h"
25 const int64_t view_id = 0;
27 std::make_shared<PlatformViewLayer>(layer_offset, layer_size, view_id);
29 layer->Preroll(preroll_context());
30 EXPECT_FALSE(preroll_context()->has_platform_view);
31 EXPECT_EQ(layer->paint_bounds(),
34 EXPECT_TRUE(layer->needs_painting(paint_context()));
35 EXPECT_FALSE(layer->subtree_has_platform_view());
37 layer->Paint(paint_context());
38 EXPECT_EQ(paint_context().canvas, &mock_canvas());
39 EXPECT_EQ(mock_canvas().draw_calls(), std::vector<MockCanvas::DrawCall>());
47 const int64_t view_id = 0;
49 std::make_shared<PlatformViewLayer>(layer_offset, layer_size, view_id);
50 auto child_clip_layer =
52 auto parent_clip_layer =
54 parent_clip_layer->Add(child_clip_layer);
55 child_clip_layer->Add(layer);
58 preroll_context()->view_embedder = &embedder;
60 parent_clip_layer->Preroll(preroll_context());
62 EXPECT_EQ(layer->paint_bounds(),
65 EXPECT_TRUE(layer->needs_painting(paint_context()));
66 EXPECT_TRUE(child_clip_layer->needs_painting(paint_context()));
67 EXPECT_TRUE(parent_clip_layer->needs_painting(paint_context()));
69 EXPECT_TRUE(child_clip_layer->subtree_has_platform_view());
70 EXPECT_TRUE(parent_clip_layer->subtree_has_platform_view());
72 parent_clip_layer->Paint(paint_context());
73 EXPECT_EQ(paint_context().canvas, &mock_canvas());
75 mock_canvas().draw_calls(),
92 const int64_t view_id = 0;
94 std::make_shared<PlatformViewLayer>(layer_offset, layer_size, view_id);
97 layer->Preroll(preroll_context());
107 const int64_t view_id = 0;
116 auto transform_layer1 = std::make_shared<TransformLayer>(transform1);
117 auto transform_layer2 = std::make_shared<TransformLayer>(transform2);
118 auto platform_layer =
119 std::make_shared<PlatformViewLayer>(layer_offset, layer_size, view_id);
120 auto child1 = std::make_shared<MockLayer>(
path1);
121 child1->set_expected_paint_matrix(transform1);
122 auto child2 = std::make_shared<MockLayer>(
path2);
123 child2->set_expected_paint_matrix(combined_transform);
124 transform_layer1->Add(child1);
125 transform_layer1->Add(platform_layer);
126 transform_layer1->Add(transform_layer2);
127 transform_layer2->Add(child2);
135 transform_layer1->Preroll(preroll_ctx);
139 transform_layer1->Paint(paint_ctx);
static SkMatrix Translate(SkScalar dx, SkScalar dy)
SkPath & addOval(const SkRect &oval, SkPathDirection dir=SkPathDirection::kCW)
TEST_F(DisplayListTest, Defaults)
LayerTestBase<::testing::Test > LayerTest
LayerTest PlatformViewLayerTest
static constexpr SkPoint Make(float x, float y)
constexpr SkRect makeOffset(float dx, float dy) const
static constexpr SkRect MakeSize(const SkSize &size)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static constexpr SkSize Make(SkScalar w, SkScalar h)
ExternalViewEmbedder * view_embedder
int renderable_state_flags
ExternalViewEmbedder * view_embedder
#define EXPECT_TRUE(handle)