Skip to content

Commit 7bb4c7b

Browse files
katex-test: Add widget tests for \overline and \underline
1 parent 840f055 commit 7bb4c7b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/model/katex.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class _KatexParser {
644644
// .overline-line,
645645
// .underline-line { width: 100%; border-bottom-style: solid; }
646646
// Border applied via inline style: border-bottom-width: 0.04em;
647-
widthEm = double.infinity;
647+
//widthEm = double.infinity;
648648
borderBottomStyle = KatexSpanBorderBottomStyle.solid;
649649
break;
650650

lib/widgets/katex.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ class _KatexSpan extends StatelessWidget {
128128
final borderColor = color ?? DefaultTextStyle.of(context).style.color!;
129129
final borderWidth = styles.borderBottomWidthEm! * em;
130130

131-
widget = DecoratedBox(
131+
widget = Container(
132+
constraints: const BoxConstraints(minWidth: double.infinity),
132133
decoration: BoxDecoration(
133134
border: Border(
134135
bottom: BorderSide(color: borderColor, width: borderWidth, style: BorderStyle.solid))),

test/widgets/katex_test.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ void main() {
8181
('a', Offset(2.47, 3.36), Size(10.88, 25.00)),
8282
('b', Offset(15.81, 3.36), Size(8.82, 25.00)),
8383
]),
84+
(KatexExample.overline, skip: false, [
85+
('A', Offset(0.0, 5.61), Size(15.43, 25.0)),
86+
('B', Offset(15.43, 5.61), Size(15.61, 25.0)),
87+
]),
88+
(KatexExample.underline, skip: false, [
89+
('A', Offset(0.0, 5.61), Size(15.43, 25.0)),
90+
('B', Offset(15.43, 5.61), Size(15.61, 25.0)),
91+
]),
8492
];
8593

8694
for (final testCase in testCases) {

0 commit comments

Comments
 (0)