@@ -805,10 +805,14 @@ void main() {
805
805
expect (paintingContext.canvas.drawnRect, isNull);
806
806
expect (paintingContext.canvas.drawnRectPaint, isNull);
807
807
selectionParagraph (paragraph, const TextPosition (offset: 1 ), const TextPosition (offset: 5 ));
808
+
809
+ paintingContext.canvas.clear ();
808
810
paragraph.paint (paintingContext, Offset .zero);
809
811
expect (paintingContext.canvas.drawnRect, const Rect .fromLTWH (14.0 , 0.0 , 56.0 , 14.0 ));
810
812
expect (paintingContext.canvas.drawnRectPaint! .style, PaintingStyle .fill);
811
813
expect (paintingContext.canvas.drawnRectPaint! .color, selectionColor);
814
+ // Selection highlight is painted before text.
815
+ expect (paintingContext.canvas.drawnItemTypes, < Type > [Rect , ui.Paragraph ]);
812
816
813
817
selectionParagraph (paragraph, const TextPosition (offset: 2 ), const TextPosition (offset: 4 ));
814
818
paragraph.paint (paintingContext, Offset .zero);
@@ -1293,15 +1297,24 @@ void main() {
1293
1297
class MockCanvas extends Fake implements Canvas {
1294
1298
Rect ? drawnRect;
1295
1299
Paint ? drawnRectPaint;
1300
+ List <Type > drawnItemTypes= < Type > [];
1296
1301
1297
1302
@override
1298
1303
void drawRect (Rect rect, Paint paint) {
1299
1304
drawnRect = rect;
1300
1305
drawnRectPaint = paint;
1306
+ drawnItemTypes.add (Rect );
1301
1307
}
1302
1308
1303
1309
@override
1304
- void drawParagraph (ui.Paragraph paragraph, Offset offset) { }
1310
+ void drawParagraph (ui.Paragraph paragraph, Offset offset) {
1311
+ drawnItemTypes.add (ui.Paragraph );
1312
+ }
1313
+ void clear () {
1314
+ drawnRect = null ;
1315
+ drawnRectPaint = null ;
1316
+ drawnItemTypes.clear ();
1317
+ }
1305
1318
}
1306
1319
1307
1320
class MockPaintingContext extends Fake implements PaintingContext {
0 commit comments