@@ -52,4 +52,56 @@ void main() {
5252 expect (childParentData.offset.dy, equals (10.0 ));
5353 expect (parent.size, equals (const Size (100.0 , 110.0 )));
5454 });
55+
56+ test ('RenderFlex and RenderIgnoreBaseline (control test -- with baseline)' , () {
57+ final RenderBox a, b;
58+ final RenderBox root = RenderFlex (
59+ crossAxisAlignment: CrossAxisAlignment .baseline,
60+ textBaseline: TextBaseline .alphabetic,
61+ textDirection: TextDirection .ltr,
62+ children: < RenderBox > [
63+ a = RenderParagraph (
64+ const TextSpan (text: 'a' , style: TextStyle (fontSize: 128.0 , fontFamily: 'FlutterTest' )), // places baseline at y=96
65+ textDirection: TextDirection .ltr,
66+ ),
67+ b = RenderParagraph (
68+ const TextSpan (text: 'b' , style: TextStyle (fontSize: 32.0 , fontFamily: 'FlutterTest' )), // 24 above baseline, 8 below baseline
69+ textDirection: TextDirection .ltr,
70+ ),
71+ ],
72+ );
73+ layout (root);
74+
75+ final Offset aPos = a.localToGlobal (Offset .zero);
76+ final Offset bPos = b.localToGlobal (Offset .zero);
77+ expect (aPos.dy, 0.0 );
78+ expect (bPos.dy, 96.0 - 24.0 );
79+ });
80+
81+ test ('RenderFlex and RenderIgnoreBaseline (with ignored baseline)' , () {
82+ final RenderBox a, b;
83+ final RenderBox root = RenderFlex (
84+ crossAxisAlignment: CrossAxisAlignment .baseline,
85+ textBaseline: TextBaseline .alphabetic,
86+ textDirection: TextDirection .ltr,
87+ children: < RenderBox > [
88+ RenderIgnoreBaseline (
89+ child: a = RenderParagraph (
90+ const TextSpan (text: 'a' , style: TextStyle (fontSize: 128.0 , fontFamily: 'FlutterTest' )),
91+ textDirection: TextDirection .ltr,
92+ ),
93+ ),
94+ b = RenderParagraph (
95+ const TextSpan (text: 'b' , style: TextStyle (fontSize: 32.0 , fontFamily: 'FlutterTest' )),
96+ textDirection: TextDirection .ltr,
97+ ),
98+ ],
99+ );
100+ layout (root);
101+
102+ final Offset aPos = a.localToGlobal (Offset .zero);
103+ final Offset bPos = b.localToGlobal (Offset .zero);
104+ expect (aPos.dy, 0.0 );
105+ expect (bPos.dy, 0.0 );
106+ });
55107}
0 commit comments