@@ -25,7 +25,6 @@ import '../example_data.dart' as eg;
2525import '../flutter_checks.dart' ;
2626import '../model/binding.dart' ;
2727import '../model/content_test.dart' ;
28- import '../model/store_checks.dart' ;
2928import '../model/test_store.dart' ;
3029import '../test_images.dart' ;
3130import '../test_navigation.dart' ;
@@ -566,22 +565,13 @@ void main() {
566565
567566 testContentSmoke (ContentExample .mathBlock);
568567
569- testWidgets ('displays KaTeX content; experimental flag enabled' , (tester) async {
570- addTearDown (testBinding.reset);
571- final globalSettings = testBinding.globalStore.settings;
572- await globalSettings.setBool (BoolGlobalSetting .renderKatex, true );
573- check (globalSettings).getBool (BoolGlobalSetting .renderKatex).isTrue ();
574-
568+ testWidgets ('displays KaTeX content' , (tester) async {
575569 await prepareContent (tester, plainContent (ContentExample .mathBlock.html));
576570 tester.widget (find.text ('λ' , findRichText: true ));
577571 });
578572
579- testWidgets ('displays KaTeX source; experimental flag disabled' , (tester) async {
580- addTearDown (testBinding.reset);
581- final globalSettings = testBinding.globalStore.settings;
582- await globalSettings.setBool (BoolGlobalSetting .renderKatex, false );
583-
584- await prepareContent (tester, plainContent (ContentExample .mathBlock.html));
573+ testWidgets ('fallback to displaying KaTeX source if unsupported KaTeX HTML' , (tester) async {
574+ await prepareContent (tester, plainContent (ContentExample .mathBlockUnknown.html));
585575 tester.widget (find.text (r'\lambda' , findRichText: true ));
586576 });
587577 });
@@ -1000,11 +990,6 @@ void main() {
1000990 testContentSmoke (ContentExample .mathInline);
1001991
1002992 testWidgets ('maintains font-size ratio with surrounding text' , (tester) async {
1003- addTearDown (testBinding.reset);
1004- final globalSettings = testBinding.globalStore.settings;
1005- await globalSettings.setBool (BoolGlobalSetting .renderKatex, true );
1006- check (globalSettings.getBool (BoolGlobalSetting .renderKatex)).isTrue ();
1007-
1008993 const html = '<span class="katex">'
1009994 '<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>'
1010995 '<annotation encoding="application/x-tex"> \\ lambda </annotation></semantics></math></span>'
@@ -1025,37 +1010,27 @@ void main() {
10251010 });
10261011 });
10271012
1028- testWidgets ('maintains font-size ratio with surrounding text, when showing TeX source' , (tester) async {
1029- addTearDown (testBinding.reset);
1030- final globalSettings = testBinding.globalStore.settings;
1031- await globalSettings.setBool (BoolGlobalSetting .renderKatex, false );
1032-
1033- const html = '<span class="katex">'
1013+ testWidgets ('maintains font-size ratio with surrounding text, when falling back to TeX source' , (tester) async {
1014+ const unsupportedHtml = '<span class="katex">'
10341015 '<span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>λ</mi></mrow>'
10351016 '<annotation encoding="application/x-tex"> \\ lambda </annotation></semantics></math></span>'
1036- '<span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">λ</span></span></span></span>' ;
1017+ '<span class="katex-html" aria-hidden="true">'
1018+ '<span class="base unknown">' // Server doesn't generate this 'unknown' class.
1019+ '<span class="strut" style="height:0.6944em;"></span>'
1020+ '<span class="mord mathnormal">λ</span></span></span></span>' ;
10371021 await checkFontSizeRatio (tester,
1038- targetHtml: html ,
1022+ targetHtml: unsupportedHtml ,
10391023 targetFontSizeFinder: mkTargetFontSizeFinderFromPattern (r'\lambda' ));
10401024 });
10411025
1042- testWidgets ('displays KaTeX content; experimental flag enabled' , (tester) async {
1043- addTearDown (testBinding.reset);
1044- final globalSettings = testBinding.globalStore.settings;
1045- await globalSettings.setBool (BoolGlobalSetting .renderKatex, true );
1046- check (globalSettings.getBool (BoolGlobalSetting .renderKatex)).isTrue ();
1047-
1026+ testWidgets ('displays KaTeX content' , (tester) async {
10481027 await prepareContent (tester, plainContent (ContentExample .mathInline.html));
10491028 tester.widget (find.text ('λ' , findRichText: true ));
10501029 });
10511030
1052- testWidgets ('displays KaTeX source; experimental flag disabled' , (tester) async {
1053- addTearDown (testBinding.reset);
1054- final globalSettings = testBinding.globalStore.settings;
1055- await globalSettings.setBool (BoolGlobalSetting .renderKatex, false );
1056-
1057- await prepareContent (tester, plainContent (ContentExample .mathInline.html));
1058- tester.widget (find.text (r'\lambda' , findRichText: true ));
1031+ testWidgets ('fallback to displaying KaTeX source if unsupported KaTeX HTML' , (tester) async {
1032+ await prepareContent (tester, plainContent (ContentExample .mathInlineUnknown.html));
1033+ tester.widget (find.text (r'\lambda' ));
10591034 });
10601035 });
10611036
0 commit comments