Skip to content

Commit 8ca68d4

Browse files
committed
katex test [nfc]: Name the KatexExample statics without redundancy
The names beginning "mathBlockKatex…" were appropriate when the namespace these lived on was the more general ContentExample. But that prefix doesn't add anything when they're on KatexExample. (The fact they're in math blocks instead of inline math spans isn't part of the point of any of these examples.) Similarly the descriptions can be shortened; and then in some cases lengthened a bit again to say more about what each example is meant to exercise or illustrate.
1 parent caf1ddb commit 8ca68d4

File tree

2 files changed

+44
-44
lines changed

2 files changed

+44
-44
lines changed

test/model/katex_test.dart

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class KatexExample extends ContentExample {
2626
// The font sizes can be compared using the katex.css generated
2727
// from katex.scss :
2828
// https://unpkg.com/[email protected]/dist/katex.css
29-
static final mathBlockKatexSizing = KatexExample.block(
30-
'math block; KaTeX different sizing',
29+
static final sizing = KatexExample.block(
30+
'different font sizes',
3131
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2155476
3232
'\\Huge 1\n\\huge 2\n\\LARGE 3\n\\Large 4\n\\large 5\n\\normalsize 6\n\\small 7\n\\footnotesize 8\n\\scriptsize 9\n\\tiny 0',
3333
'<p>'
@@ -82,8 +82,8 @@ class KatexExample extends ContentExample {
8282
]),
8383
]);
8484

85-
static final mathBlockKatexNestedSizing = KatexExample.block(
86-
'math block; KaTeX nested sizing',
85+
static final nestedSizing = KatexExample.block(
86+
'sizing spans nested',
8787
r'\tiny {1 \Huge 2}',
8888
'<p>'
8989
'<span class="katex-display"><span class="katex">'
@@ -108,8 +108,8 @@ class KatexExample extends ContentExample {
108108
]),
109109
]);
110110

111-
static final mathBlockKatexDelimSizing = KatexExample.block(
112-
'math block; KaTeX delimiter sizing',
111+
static final delimsizing = KatexExample.block(
112+
'delimsizing spans, big delimiters',
113113
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2147135
114114
r'⟨ \big( \Big[ \bigg⌈ \Bigg⌊',
115115
'<p>'
@@ -150,8 +150,8 @@ class KatexExample extends ContentExample {
150150
]),
151151
]);
152152

153-
static final mathBlockKatexSpace = KatexExample.block(
154-
'math block; KaTeX space',
153+
static final spacing = KatexExample.block(
154+
'positive horizontal spacing with margin-right',
155155
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2214883
156156
'1:2',
157157
'<p>'
@@ -184,8 +184,8 @@ class KatexExample extends ContentExample {
184184
]),
185185
]);
186186

187-
static final mathBlockKatexSuperscript = KatexExample.block(
188-
'math block, KaTeX superscript; single vlist-r, single vertical offset row',
187+
static final vlistSuperscript = KatexExample.block(
188+
'superscript: single vlist-r, single vertical offset row',
189189
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2176734
190190
"a'",
191191
'<p>'
@@ -234,8 +234,8 @@ class KatexExample extends ContentExample {
234234
]),
235235
]);
236236

237-
static final mathBlockKatexSubscript = KatexExample.block(
238-
'math block, KaTeX subscript; two vlist-r, single vertical offset row',
237+
static final vlistSubscript = KatexExample.block(
238+
'subscript: two vlist-r, single vertical offset row',
239239
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2176735
240240
'x_n',
241241
'<p>'
@@ -288,8 +288,8 @@ class KatexExample extends ContentExample {
288288
]),
289289
]);
290290

291-
static final mathBlockKatexSubSuperScript = KatexExample.block(
292-
'math block, KaTeX subsup script; two vlist-r, multiple vertical offset rows',
291+
static final vlistSubAndSuperscript = KatexExample.block(
292+
'subscript and superscript: two vlist-r, multiple vertical offset rows',
293293
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2176738
294294
'_u^o',
295295
'<p>'
@@ -356,8 +356,8 @@ class KatexExample extends ContentExample {
356356
]),
357357
]);
358358

359-
static final mathBlockKatexRaisebox = KatexExample.block(
360-
'math block, KaTeX raisebox; single vlist-r, single vertical offset row',
359+
static final vlistRaisebox = KatexExample.block(
360+
r'\raisebox: single vlist-r, single vertical offset row',
361361
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2176739
362362
r'a\raisebox{0.25em}{$b$}c',
363363
'<p>'
@@ -398,8 +398,8 @@ class KatexExample extends ContentExample {
398398
]),
399399
]);
400400

401-
static final mathBlockKatexNegativeMargin = KatexExample.block(
402-
'math block, KaTeX negative margin',
401+
static final negativeMargin = KatexExample.block(
402+
r'negative horizontal margin (\!)',
403403
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2223563
404404
r'1 \! 2',
405405
'<p>'
@@ -421,8 +421,8 @@ class KatexExample extends ContentExample {
421421
]),
422422
]);
423423

424-
static final mathBlockKatexLogo = KatexExample.block(
425-
'math block, KaTeX logo',
424+
static final katexLogo = KatexExample.block(
425+
'KaTeX logo: vlists, negative margins',
426426
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2141902
427427
r'\KaTeX',
428428
'<p>'
@@ -509,8 +509,8 @@ class KatexExample extends ContentExample {
509509
]),
510510
]);
511511

512-
static final mathBlockKatexNegativeMarginsOnVlistRow = KatexExample.block(
513-
'math block, KaTeX negative margins on a vlist row',
512+
static final vlistNegativeMargin = KatexExample.block(
513+
'vlist using negative margin (subscript X_n)',
514514
// https://chat.zulip.org/#narrow/channel/7-test-here/topic/Rajesh/near/2224918
515515
'X_n',
516516
'<p>'
@@ -571,17 +571,17 @@ class KatexExample extends ContentExample {
571571
void main() async {
572572
TestZulipBinding.ensureInitialized();
573573

574-
testParseExample(KatexExample.mathBlockKatexSizing);
575-
testParseExample(KatexExample.mathBlockKatexNestedSizing);
576-
testParseExample(KatexExample.mathBlockKatexDelimSizing);
577-
testParseExample(KatexExample.mathBlockKatexSpace);
578-
testParseExample(KatexExample.mathBlockKatexSuperscript);
579-
testParseExample(KatexExample.mathBlockKatexSubscript);
580-
testParseExample(KatexExample.mathBlockKatexSubSuperScript);
581-
testParseExample(KatexExample.mathBlockKatexRaisebox);
582-
testParseExample(KatexExample.mathBlockKatexNegativeMargin);
583-
testParseExample(KatexExample.mathBlockKatexLogo);
584-
testParseExample(KatexExample.mathBlockKatexNegativeMarginsOnVlistRow);
574+
testParseExample(KatexExample.sizing);
575+
testParseExample(KatexExample.nestedSizing);
576+
testParseExample(KatexExample.delimsizing);
577+
testParseExample(KatexExample.spacing);
578+
testParseExample(KatexExample.vlistSuperscript);
579+
testParseExample(KatexExample.vlistSubscript);
580+
testParseExample(KatexExample.vlistSubAndSuperscript);
581+
testParseExample(KatexExample.vlistRaisebox);
582+
testParseExample(KatexExample.negativeMargin);
583+
testParseExample(KatexExample.katexLogo);
584+
testParseExample(KatexExample.vlistNegativeMargin);
585585

586586
test('all KaTeX content examples are tested', () {
587587
// Check that every KatexExample defined above has a corresponding

test/widgets/katex_test.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void main() {
1414
group('MathBlock', () {
1515
group('characters render at specific offsets with specific size', () {
1616
final testCases = <(KatexExample, List<(String, Offset, Size)>, {bool? skip})>[
17-
(KatexExample.mathBlockKatexSizing, skip: false, [
17+
(KatexExample.sizing, skip: false, [
1818
('1', Offset(0.00, 2.24), Size(25.59, 61.00)),
1919
('2', Offset(25.59, 10.04), Size(21.33, 51.00)),
2020
('3', Offset(46.91, 16.55), Size(17.77, 43.00)),
@@ -26,50 +26,50 @@ void main() {
2626
('9', Offset(119.58, 35.91), Size(7.20, 17.00)),
2727
('0', Offset(126.77, 39.68), Size(5.14, 12.00)),
2828
]),
29-
(KatexExample.mathBlockKatexNestedSizing, skip: false, [
29+
(KatexExample.nestedSizing, skip: false, [
3030
('1', Offset(0.00, 40.24), Size(5.14, 12.00)),
3131
('2', Offset(5.14, 2.80), Size(25.59, 61.00)),
3232
]),
33-
(KatexExample.mathBlockKatexDelimSizing, skip: false, [
33+
(KatexExample.delimsizing, skip: false, [
3434
('(', Offset(8.00, 20.14), Size(9.42, 25.00)),
3535
('[', Offset(17.42, 20.14), Size(9.71, 25.00)),
3636
('⌈', Offset(27.12, 20.14), Size(11.99, 25.00)),
3737
('⌊', Offset(39.11, 20.14), Size(13.14, 25.00)),
3838
]),
39-
(KatexExample.mathBlockKatexSpace, skip: false, [
39+
(KatexExample.spacing, skip: false, [
4040
('1', Offset(0.00, 2.24), Size(10.28, 25.00)),
4141
(':', Offset(16.00, 2.24), Size(5.72, 25.00)),
4242
('2', Offset(27.43, 2.24), Size(10.28, 25.00)),
4343
]),
44-
(KatexExample.mathBlockKatexSuperscript, skip: false, [
44+
(KatexExample.vlistSuperscript, skip: false, [
4545
('a', Offset(0.00, 5.28), Size(10.88, 25.00)),
4646
('′', Offset(10.88, 1.13), Size(3.96, 17.00)),
4747
]),
48-
(KatexExample.mathBlockKatexSubscript, skip: false, [
48+
(KatexExample.vlistSubscript, skip: false, [
4949
('x', Offset(0.00, 5.28), Size(11.76, 25.00)),
5050
('n', Offset(11.76, 13.65), Size(8.63, 17.00)),
5151
]),
52-
(KatexExample.mathBlockKatexSubSuperScript, skip: false, [
52+
(KatexExample.vlistSubAndSuperscript, skip: false, [
5353
('u', Offset(0.00, 15.65), Size(8.23, 17.00)),
5454
('o', Offset(0.00, 2.07), Size(6.98, 17.00)),
5555
]),
56-
(KatexExample.mathBlockKatexRaisebox, skip: false, [
56+
(KatexExample.vlistRaisebox, skip: false, [
5757
('a', Offset(0.00, 4.16), Size(10.88, 25.00)),
5858
('b', Offset(10.88, -0.66), Size(8.82, 25.00)),
5959
('c', Offset(19.70, 4.16), Size(8.90, 25.00)),
6060
]),
61-
(KatexExample.mathBlockKatexNegativeMargin, skip: false, [
61+
(KatexExample.negativeMargin, skip: false, [
6262
('1', Offset(0.00, 3.12), Size(10.28, 25.00)),
6363
('2', Offset(6.85, 3.36), Size(10.28, 25.00)),
6464
]),
65-
(KatexExample.mathBlockKatexLogo, skip: false, [
65+
(KatexExample.katexLogo, skip: false, [
6666
('K', Offset(0.0, 8.64), Size(16.0, 25.0)),
6767
('A', Offset(12.50, 10.85), Size(10.79, 17.0)),
6868
('T', Offset(20.21, 9.36), Size(14.85, 25.0)),
6969
('E', Offset(31.63, 14.52), Size(14.0, 25.0)),
7070
('X', Offset(43.06, 9.85), Size(15.42, 25.0)),
7171
]),
72-
(KatexExample.mathBlockKatexNegativeMarginsOnVlistRow, skip: false, [
72+
(KatexExample.vlistNegativeMargin, skip: false, [
7373
('X', Offset(0.00, 7.04), Size(17.03, 25.00)),
7474
('n', Offset(17.03, 15.90), Size(8.63, 17.00)),
7575
]),

0 commit comments

Comments
 (0)