5#include "flutter/display_list/utils/dl_accumulation_rect.h"
6#include "flutter/testing/assertions_skia.h"
7#include "gtest/gtest.h"
12TEST(DisplayListAccumulationRect, Constructor) {
20TEST(DisplayListAccumulationRect, OnePoint) {
29TEST(DisplayListAccumulationRect, TwoPoints) {
33 bool should_be_empty,
bool should_overlap,
34 const std::string& label) {
40 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
41 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
51 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
52 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
62 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
63 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
72 true,
false,
"Horizontal");
74 true,
false,
"Vertical");
76 false,
false,
"Diagonal");
79TEST(DisplayListAccumulationRect, ThreePoints) {
84 bool should_be_empty,
bool should_overlap,
85 const std::string& label) {
92 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
93 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
104 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
105 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
116 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
117 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
123 test(10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f,
125 test(10.0f, 10.0f, 20.0f, 10.0f, 15.0f, 10.0f,
127 test(10.0f, 10.0f, 10.0f, 20.0f, 10.0f, 15.0f,
129 test(10.0f, 10.0f, 20.0f, 20.0f, 25.0f, 15.0f,
131 test(10.0f, 10.0f, 20.0f, 20.0f, 15.0f, 15.0f,
135TEST(DisplayListAccumulationRect, EmptyRect) {
138 bool should_be_empty,
bool should_overlap,
139 const std::string& label) {
144 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
145 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
154 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
155 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
164 EXPECT_EQ(
content.is_empty(), should_be_empty) << label;
165 EXPECT_EQ(
content.bounds().isEmpty(), should_be_empty) << label;
169 if (!should_be_empty) {
172 EXPECT_EQ(
content.overlap_detected(), should_overlap) << label;
177 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
178 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
185 true,
false,
"Singular");
187 true,
false,
"Horizontal Empty");
189 true,
false,
"Vertical Empty");
191 false,
false,
"Non-Empty");
194TEST(DisplayListAccumulationRect, TwoRects) {
198 bool should_be_empty,
bool should_overlap,
199 const std::string& label) {
205 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
206 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
216 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
217 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
235 EXPECT_EQ(accumulator.
is_empty(), should_be_empty) << label;
236 EXPECT_EQ(accumulator.
bounds().
isEmpty(), should_be_empty) << label;
242 test(10.0f, 10.0f, 10.0f, 10.0f,
243 20.0f, 20.0f, 20.0f, 20.0f,
245 true,
false,
"Empty + Empty");
246 test(10.0f, 10.0f, 20.0f, 10.0f,
247 10.0f, 10.0f, 10.0f, 20.0f,
249 true,
false,
"Horizontal + Vertical");
250 test(10.0f, 10.0f, 10.0f, 10.0f,
251 15.0f, 15.0f, 20.0f, 20.0f,
253 false,
false,
"Empty + Non-Empty");
254 test(10.0f, 10.0f, 15.0f, 15.0f,
255 20.0f, 20.0f, 20.0f, 20.0f,
257 false,
false,
"Non-Empty + Empty");
258 test(10.0f, 10.0f, 15.0f, 15.0f,
259 15.0f, 15.0f, 20.0f, 20.0f,
261 false,
false,
"Abutting");
262 test(10.0f, 10.0f, 15.0f, 15.0f,
263 16.0f, 16.0f, 20.0f, 20.0f,
265 false,
false,
"Disjoint");
266 test(10.0f, 10.0f, 16.0f, 16.0f,
267 15.0f, 15.0f, 20.0f, 20.0f,
269 false,
true,
"Overlapping");
bool overlap_detected() const
void accumulate(SkScalar x, SkScalar y)
union flutter::testing::@2836::KeyboardChange::@76 content
Optional< SkRect > bounds
TEST(DisplayListComplexity, EmptyDisplayList)
impeller::Scalar DlScalar
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
#define EXPECT_TRUE(handle)