@@ -2250,5 +2250,58 @@ TEST(DisplayList, DiffClipPathDoesNotAffectClipBounds) {
22502250 ASSERT_EQ (builder.getDestinationClipBounds (), initialDestinationBounds);
22512251}
22522252
2253+ TEST (DisplayList, FlatDrawPointsProducesBounds) {
2254+ SkPoint horizontal_points[2 ] = {{10 , 10 }, {20 , 10 }};
2255+ SkPoint vertical_points[2 ] = {{10 , 10 }, {10 , 20 }};
2256+ {
2257+ DisplayListBuilder builder;
2258+ builder.drawPoints (SkCanvas::kPolygon_PointMode , 2 , horizontal_points);
2259+ SkRect bounds = builder.Build ()->bounds ();
2260+ EXPECT_TRUE (bounds.contains (10 , 10 ));
2261+ EXPECT_TRUE (bounds.contains (20 , 10 ));
2262+ EXPECT_GE (bounds.width (), 10 );
2263+ }
2264+ {
2265+ DisplayListBuilder builder;
2266+ builder.drawPoints (SkCanvas::kPolygon_PointMode , 2 , vertical_points);
2267+ SkRect bounds = builder.Build ()->bounds ();
2268+ EXPECT_TRUE (bounds.contains (10 , 10 ));
2269+ EXPECT_TRUE (bounds.contains (10 , 20 ));
2270+ EXPECT_GE (bounds.height (), 10 );
2271+ }
2272+ {
2273+ DisplayListBuilder builder;
2274+ builder.drawPoints (SkCanvas::kPoints_PointMode , 1 , horizontal_points);
2275+ SkRect bounds = builder.Build ()->bounds ();
2276+ EXPECT_TRUE (bounds.contains (10 , 10 ));
2277+ }
2278+ {
2279+ DisplayListBuilder builder;
2280+ builder.setStrokeWidth (2 );
2281+ builder.drawPoints (SkCanvas::kPolygon_PointMode , 2 , horizontal_points);
2282+ SkRect bounds = builder.Build ()->bounds ();
2283+ EXPECT_TRUE (bounds.contains (10 , 10 ));
2284+ EXPECT_TRUE (bounds.contains (20 , 10 ));
2285+ EXPECT_EQ (bounds, SkRect::MakeLTRB (9 , 9 , 21 , 11 ));
2286+ }
2287+ {
2288+ DisplayListBuilder builder;
2289+ builder.setStrokeWidth (2 );
2290+ builder.drawPoints (SkCanvas::kPolygon_PointMode , 2 , vertical_points);
2291+ SkRect bounds = builder.Build ()->bounds ();
2292+ EXPECT_TRUE (bounds.contains (10 , 10 ));
2293+ EXPECT_TRUE (bounds.contains (10 , 20 ));
2294+ EXPECT_EQ (bounds, SkRect::MakeLTRB (9 , 9 , 11 , 21 ));
2295+ }
2296+ {
2297+ DisplayListBuilder builder;
2298+ builder.setStrokeWidth (2 );
2299+ builder.drawPoints (SkCanvas::kPoints_PointMode , 1 , horizontal_points);
2300+ SkRect bounds = builder.Build ()->bounds ();
2301+ EXPECT_TRUE (bounds.contains (10 , 10 ));
2302+ EXPECT_EQ (bounds, SkRect::MakeLTRB (9 , 9 , 11 , 11 ));
2303+ }
2304+ }
2305+
22532306} // namespace testing
22542307} // namespace flutter
0 commit comments