@@ -729,6 +729,43 @@ void main() {
729
729
});
730
730
}
731
731
});
732
+
733
+ testWidgets ('golden tests' , (tester) async {
734
+ await _loadKatexFonts ();
735
+
736
+ addTearDown (testBinding.reset);
737
+ final globalSettings = testBinding.globalStore.settings;
738
+ await globalSettings.setBool (BoolGlobalSetting .renderKatex, true );
739
+ check (globalSettings).getBool (BoolGlobalSetting .renderKatex).isTrue ();
740
+
741
+ final contentHtml =
742
+ ContentExample .mathBlockKatexSizing.html +
743
+ ContentExample .mathBlockKatexNestedSizing.html +
744
+ ContentExample .mathBlockKatexDelimSizing.html +
745
+ ContentExample .mathBlockKatexVertical1.html +
746
+ ContentExample .mathBlockKatexVertical2.html +
747
+ ContentExample .mathBlockKatexVertical3.html +
748
+ ContentExample .mathBlockKatexVertical4.html +
749
+ ContentExample .mathBlockKatexVertical5.html;
750
+
751
+ await prepareContent (tester, Builder (builder: (context) =>
752
+ DefaultTextStyle (
753
+ style: ContentTheme .of (context).textStylePlainParagraph,
754
+ child: BlockContentList (
755
+ nodes: parseContent (contentHtml).nodes.map ((node) {
756
+ final mathBlockNode = node as MathBlockNode ;
757
+ return ParagraphNode (
758
+ links: null ,
759
+ nodes: [
760
+ MathInlineNode (
761
+ texSource: mathBlockNode.texSource,
762
+ nodes: mathBlockNode.nodes),
763
+ ]);
764
+ }).toList (growable: false )))));
765
+
766
+ await check (find.byType (BlockContentList ))
767
+ .matchesGoldenFile (Uri .file ('goldens/katex.png' ));
768
+ });
732
769
});
733
770
734
771
/// Make a [TargetFontSizeFinder] to pass to [checkFontSizeRatio] ,
@@ -1492,4 +1529,4 @@ Future<void> _loadKatexFonts() async {
1492
1529
Future .value (fontFile.readAsBytesSync ().buffer.asByteData ());
1493
1530
await (FontLoader (fontName)..addFont (bytes)).load ();
1494
1531
}
1495
- }
1532
+ }
0 commit comments