@@ -595,15 +595,19 @@ void main() {
595
595
final content = ContentExample .mathBlockKatexSizing;
596
596
await prepareContent (tester, plainContent (content.html));
597
597
598
+ final context = tester.element (find.byType (MathBlock ));
599
+ final baseTextStyle =
600
+ mkBaseKatexTextStyle (ContentTheme .of (context).textStylePlainParagraph);
601
+
598
602
final mathBlockNode = content.expectedNodes.single as MathBlockNode ;
599
603
final baseNode = mathBlockNode.nodes! .single;
600
604
final nodes = baseNode.nodes! .skip (1 ); // Skip .strut node.
601
605
for (final katexNode in nodes) {
602
- final fontSize = katexNode.styles.fontSizeEm! * kBaseKatexTextStyle .fontSize! ;
606
+ final fontSize = katexNode.styles.fontSizeEm! * baseTextStyle .fontSize! ;
603
607
checkKatexText (tester, katexNode.text! ,
604
608
fontFamily: 'KaTeX_Main' ,
605
609
fontSize: fontSize,
606
- fontHeight: kBaseKatexTextStyle .height! );
610
+ fontHeight: baseTextStyle .height! );
607
611
}
608
612
});
609
613
@@ -616,17 +620,21 @@ void main() {
616
620
final content = ContentExample .mathBlockKatexNestedSizing;
617
621
await prepareContent (tester, plainContent (content.html));
618
622
619
- var fontSize = 0.5 * kBaseKatexTextStyle.fontSize! ;
623
+ final context = tester.element (find.byType (MathBlock ));
624
+ final baseTextStyle =
625
+ mkBaseKatexTextStyle (ContentTheme .of (context).textStylePlainParagraph);
626
+
627
+ var fontSize = 0.5 * baseTextStyle.fontSize! ;
620
628
checkKatexText (tester, '1' ,
621
629
fontFamily: 'KaTeX_Main' ,
622
630
fontSize: fontSize,
623
- fontHeight: kBaseKatexTextStyle .height! );
631
+ fontHeight: baseTextStyle .height! );
624
632
625
633
fontSize = 4.976 * fontSize;
626
634
checkKatexText (tester, '2' ,
627
635
fontFamily: 'KaTeX_Main' ,
628
636
fontSize: fontSize,
629
- fontHeight: kBaseKatexTextStyle .height! );
637
+ fontHeight: baseTextStyle .height! );
630
638
});
631
639
632
640
testWidgets ('displays KaTeX content with different delimiter sizing' , (tester) async {
@@ -642,22 +650,24 @@ void main() {
642
650
final baseNode = mathBlockNode.nodes! .single;
643
651
var nodes = baseNode.nodes! .skip (1 ); // Skip .strut node.
644
652
645
- final fontSize = kBaseKatexTextStyle.fontSize! ;
653
+ final context = tester.element (find.byType (MathBlock ));
654
+ final baseTextStyle =
655
+ mkBaseKatexTextStyle (ContentTheme .of (context).textStylePlainParagraph);
646
656
647
657
final firstNode = nodes.first;
648
658
checkKatexText (tester, firstNode.text! ,
649
659
fontFamily: 'KaTeX_Main' ,
650
- fontSize: fontSize,
651
- fontHeight: kBaseKatexTextStyle .height! );
660
+ fontSize: baseTextStyle. fontSize! ,
661
+ fontHeight: baseTextStyle .height! );
652
662
nodes = nodes.skip (1 );
653
663
654
664
for (var katexNode in nodes) {
655
665
katexNode = katexNode.nodes! .single; // Skip empty .mord parent.
656
666
final fontFamily = katexNode.styles.fontFamily! ;
657
667
checkKatexText (tester, katexNode.text! ,
658
668
fontFamily: fontFamily,
659
- fontSize: fontSize,
660
- fontHeight: kBaseKatexTextStyle .height! );
669
+ fontSize: baseTextStyle. fontSize! ,
670
+ fontHeight: baseTextStyle .height! );
661
671
}
662
672
});
663
673
});
0 commit comments