Skip to content

Commit bfe52fa

Browse files
gnpricechrisbobbe
authored andcommitted
content test [nfc]: Add a typedef TargetFontSizeFinder
1 parent bfb2b97 commit bfe52fa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/widgets/content_test.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ TextStyle? mergedStyleOfSubstring(InlineSpan rootSpan, Pattern substringPattern)
7979
});
8080
}
8181

82+
/// A callback that finds some target subspan within the given span,
83+
/// and reports the target's font size.
84+
typedef TargetFontSizeFinder = double Function(InlineSpan rootSpan);
85+
8286
void main() {
8387
// For testing a new content feature:
8488
//
@@ -495,9 +499,9 @@ void main() {
495499

496500
testContentSmoke(ContentExample.mathBlock);
497501

498-
/// Make a [targetFontSizeFinder] for [checkFontSizeRatio],
502+
/// Make a [TargetFontSizeFinder] to pass to [checkFontSizeRatio],
499503
/// from a target [Pattern] (such as a string).
500-
mkTargetFontSizeFinderFromPattern(Pattern targetPattern)
504+
TargetFontSizeFinder mkTargetFontSizeFinderFromPattern(Pattern targetPattern)
501505
=> (InlineSpan rootSpan)
502506
=> mergedStyleOfSubstring(rootSpan, targetPattern)!.fontSize!;
503507

@@ -512,7 +516,7 @@ void main() {
512516
/// in [GlobalTime].)
513517
Future<void> checkFontSizeRatio(WidgetTester tester, {
514518
required String targetHtml,
515-
required double Function(InlineSpan rootSpan) targetFontSizeFinder,
519+
required TargetFontSizeFinder targetFontSizeFinder,
516520
}) async {
517521
await prepareContent(tester, plainContent(
518522
'<h1>header-plain $targetHtml</h1>\n'

0 commit comments

Comments
 (0)