Unverified Commit f4551e64 authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

Reland "Update test font (#121306)" (#122068)

Reland "Update test font (#121306)"
parent c5da5070
...@@ -12,7 +12,6 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -12,7 +12,6 @@ import 'package:flutter_test/flutter_test.dart';
import '../widgets/semantics_tester.dart'; import '../widgets/semantics_tester.dart';
const TextStyle testStyle = TextStyle( const TextStyle testStyle = TextStyle(
fontFamily: 'Ahem',
fontSize: 10.0, fontSize: 10.0,
letterSpacing: 0.0, letterSpacing: 0.0,
); );
......
...@@ -160,7 +160,7 @@ void main() { ...@@ -160,7 +160,7 @@ void main() {
// Also shows the previous page's title next to the back button. // Also shows the previous page's title next to the back button.
expect(find.widgetWithText(CupertinoButton, 'An iPod'), findsOneWidget); expect(find.widgetWithText(CupertinoButton, 'An iPod'), findsOneWidget);
// 3 paddings + 1 ahem character at font size 34.0. // 3 paddings + 1 test font character at font size 34.0.
expect(tester.getTopLeft(find.text('An iPod')).dx, 8.0 + 4.0 + 34.0 + 6.0); expect(tester.getTopLeft(find.text('An iPod')).dx, 8.0 + 4.0 + 34.0 + 6.0);
}); });
......
...@@ -3496,10 +3496,7 @@ void main() { ...@@ -3496,10 +3496,7 @@ void main() {
child: CupertinoTextField( child: CupertinoTextField(
dragStartBehavior: DragStartBehavior.down, dragStartBehavior: DragStartBehavior.down,
controller: controller, controller: controller,
style: const TextStyle( style: const TextStyle(fontSize: 10.0),
fontFamily: 'Ahem',
fontSize: 10.0,
),
), ),
), ),
), ),
...@@ -4045,10 +4042,7 @@ void main() { ...@@ -4045,10 +4042,7 @@ void main() {
child: CupertinoTextField( child: CupertinoTextField(
dragStartBehavior: DragStartBehavior.down, dragStartBehavior: DragStartBehavior.down,
controller: controller, controller: controller,
style: const TextStyle( style: const TextStyle(fontSize: 10.0),
fontFamily: 'Ahem',
fontSize: 10.0,
),
), ),
), ),
), ),
...@@ -4180,10 +4174,7 @@ void main() { ...@@ -4180,10 +4174,7 @@ void main() {
child: CupertinoTextField( child: CupertinoTextField(
dragStartBehavior: DragStartBehavior.down, dragStartBehavior: DragStartBehavior.down,
controller: controller, controller: controller,
style: const TextStyle( style: const TextStyle(fontSize: 10.0),
fontFamily: 'Ahem',
fontSize: 10.0,
),
), ),
), ),
), ),
...@@ -7858,7 +7849,6 @@ void main() { ...@@ -7858,7 +7849,6 @@ void main() {
testWidgets('placeholder style overflow works', (WidgetTester tester) async { testWidgets('placeholder style overflow works', (WidgetTester tester) async {
final String placeholder = 'hint text' * 20; final String placeholder = 'hint text' * 20;
const TextStyle placeholderStyle = TextStyle( const TextStyle placeholderStyle = TextStyle(
fontFamily: 'Ahem',
fontSize: 14.0, fontSize: 14.0,
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
); );
......
...@@ -576,7 +576,7 @@ void main() { ...@@ -576,7 +576,7 @@ void main() {
); );
testWidgets('Chip in row works ok', (WidgetTester tester) async { testWidgets('Chip in row works ok', (WidgetTester tester) async {
const TextStyle style = TextStyle(fontFamily: 'Ahem', fontSize: 10.0); const TextStyle style = TextStyle(fontSize: 10.0);
await tester.pumpWidget( await tester.pumpWidget(
wrapForChip( wrapForChip(
child: const Row( child: const Row(
......
...@@ -288,24 +288,24 @@ void main() { ...@@ -288,24 +288,24 @@ void main() {
testWidgets('Tab sizing - text', (WidgetTester tester) async { testWidgets('Tab sizing - text', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp(theme: ThemeData(fontFamily: 'Ahem'), home: const Center(child: Material(child: Tab(text: 'x')))), MaterialApp(theme: ThemeData(fontFamily: 'FlutterTest'), home: const Center(child: Material(child: Tab(text: 'x')))),
); );
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'Ahem'); expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
expect(tester.getSize(find.byType(Tab)), const Size(14.0, 46.0)); expect(tester.getSize(find.byType(Tab)), const Size(14.0, 46.0));
}); });
testWidgets('Tab sizing - icon and text', (WidgetTester tester) async { testWidgets('Tab sizing - icon and text', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp(theme: ThemeData(fontFamily: 'Ahem'), home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), text: 'x')))), MaterialApp(theme: ThemeData(fontFamily: 'FlutterTest'), home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), text: 'x')))),
); );
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'Ahem'); expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
expect(tester.getSize(find.byType(Tab)), const Size(14.0, 72.0)); expect(tester.getSize(find.byType(Tab)), const Size(14.0, 72.0));
}); });
testWidgets('Tab sizing - icon, iconMargin and text', (WidgetTester tester) async { testWidgets('Tab sizing - icon, iconMargin and text', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData(fontFamily: 'Ahem'), theme: ThemeData(fontFamily: 'FlutterTest'),
home: const Center( home: const Center(
child: Material( child: Material(
child: Tab( child: Tab(
...@@ -322,15 +322,15 @@ void main() { ...@@ -322,15 +322,15 @@ void main() {
), ),
), ),
); );
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'Ahem'); expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
expect(tester.getSize(find.byType(Tab)), const Size(210.0, 72.0)); expect(tester.getSize(find.byType(Tab)), const Size(210.0, 72.0));
}); });
testWidgets('Tab sizing - icon and child', (WidgetTester tester) async { testWidgets('Tab sizing - icon and child', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp(theme: ThemeData(fontFamily: 'Ahem'), home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), child: Text('x'))))), MaterialApp(theme: ThemeData(fontFamily: 'FlutterTest'), home: const Center(child: Material(child: Tab(icon: SizedBox(width: 10.0, height: 10.0), child: Text('x'))))),
); );
expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'Ahem'); expect(tester.renderObject<RenderParagraph>(find.byType(RichText)).text.style!.fontFamily, 'FlutterTest');
expect(tester.getSize(find.byType(Tab)), const Size(14.0, 72.0)); expect(tester.getSize(find.byType(Tab)), const Size(14.0, 72.0));
}); });
......
...@@ -2241,7 +2241,7 @@ void main() { ...@@ -2241,7 +2241,7 @@ void main() {
child: TextField( child: TextField(
dragStartBehavior: DragStartBehavior.down, dragStartBehavior: DragStartBehavior.down,
controller: controller, controller: controller,
style: const TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: const TextStyle(fontSize: 10.0),
), ),
), ),
), ),
...@@ -6913,20 +6913,26 @@ void main() { ...@@ -6913,20 +6913,26 @@ void main() {
key: keyA, key: keyA,
decoration: null, decoration: null,
controller: controllerA, controller: controllerA,
style: const TextStyle(fontSize: 10.0), // The point size of the font must be a multiple of 4 until
// https://github.com/flutter/flutter/issues/122066 is resolved.
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 12.0),
strutStyle: StrutStyle.disabled, strutStyle: StrutStyle.disabled,
), ),
), ),
const Text( const Text(
'abc', 'abc',
style: TextStyle(fontSize: 20.0), // The point size of the font must be a multiple of 4 until
// https://github.com/flutter/flutter/issues/122066 is resolved.
style: TextStyle(fontFamily: 'FlutterTest', fontSize: 24.0),
), ),
Expanded( Expanded(
child: TextField( child: TextField(
key: keyB, key: keyB,
decoration: null, decoration: null,
controller: controllerB, controller: controllerB,
style: const TextStyle(fontSize: 30.0), // The point size of the font must be a multiple of 4 until
// https://github.com/flutter/flutter/issues/122066 is resolved.
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 36.0),
strutStyle: StrutStyle.disabled, strutStyle: StrutStyle.disabled,
), ),
), ),
...@@ -6935,17 +6941,17 @@ void main() { ...@@ -6935,17 +6941,17 @@ void main() {
), ),
); );
// The Ahem font extends 0.2 * fontSize below the baseline. // The test font extends 0.25 * fontSize below the baseline.
// So the three row elements line up like this: // So the three row elements line up like this:
// //
// A abc B // A abc B
// --------- baseline // --------- baseline
// 2 4 6 space below the baseline = 0.2 * fontSize // 3 6 9 space below the baseline = 0.25 * fontSize
// --------- rowBottomY // --------- rowBottomY
final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy; final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy;
expect(tester.getBottomLeft(find.byKey(keyA)).dy, moreOrLessEquals(rowBottomY - 4.0, epsilon: 0.001)); expect(tester.getBottomLeft(find.byKey(keyA)).dy, rowBottomY - 6.0);
expect(tester.getBottomLeft(find.text('abc')).dy, moreOrLessEquals(rowBottomY - 2.0, epsilon: 0.001)); expect(tester.getBottomLeft(find.text('abc')).dy, rowBottomY - 3.0);
expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY); expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY);
}); });
...@@ -6966,19 +6972,25 @@ void main() { ...@@ -6966,19 +6972,25 @@ void main() {
key: keyA, key: keyA,
decoration: null, decoration: null,
controller: controllerA, controller: controllerA,
style: const TextStyle(fontSize: 10.0), // The point size of the font must be a multiple of 4 until
// https://github.com/flutter/flutter/issues/122066 is resolved.
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 12.0),
), ),
), ),
const Text( const Text(
'abc', 'abc',
style: TextStyle(fontSize: 20.0), // The point size of the font must be a multiple of 4 until
// https://github.com/flutter/flutter/issues/122066 is resolved.
style: TextStyle(fontFamily: 'FlutterTest', fontSize: 24.0),
), ),
Expanded( Expanded(
child: TextField( child: TextField(
key: keyB, key: keyB,
decoration: null, decoration: null,
controller: controllerB, controller: controllerB,
style: const TextStyle(fontSize: 30.0), // The point size of the font must be a multiple of 4 until
// https://github.com/flutter/flutter/issues/122066 is resolved.
style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 36.0),
), ),
), ),
], ],
...@@ -6986,18 +6998,18 @@ void main() { ...@@ -6986,18 +6998,18 @@ void main() {
), ),
); );
// The Ahem font extends 0.2 * fontSize below the baseline. // The test font extends 0.25 * fontSize below the baseline.
// So the three row elements line up like this: // So the three row elements line up like this:
// //
// A abc B // A abc B
// --------- baseline // --------- baseline
// 2 4 6 space below the baseline = 0.2 * fontSize // 3 6 9 space below the baseline = 0.25 * fontSize
// --------- rowBottomY // --------- rowBottomY
final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy; final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy;
// The values here should match the version with strut disabled ('TextField baseline alignment no-strut') // The values here should match the version with strut disabled ('TextField baseline alignment no-strut')
expect(tester.getBottomLeft(find.byKey(keyA)).dy, moreOrLessEquals(rowBottomY - 4.0, epsilon: 0.001)); expect(tester.getBottomLeft(find.byKey(keyA)).dy, rowBottomY - 6.0);
expect(tester.getBottomLeft(find.text('abc')).dy, moreOrLessEquals(rowBottomY - 2.0, epsilon: 0.001)); expect(tester.getBottomLeft(find.text('abc')).dy, rowBottomY - 3.0);
expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY); expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY);
}); });
......
...@@ -101,14 +101,14 @@ void main() { ...@@ -101,14 +101,14 @@ void main() {
test('Can control fontFamily default', () { test('Can control fontFamily default', () {
final ThemeData themeData = ThemeData( final ThemeData themeData = ThemeData(
fontFamily: 'Ahem', fontFamily: 'FlutterTest',
textTheme: const TextTheme( textTheme: const TextTheme(
titleLarge: TextStyle(fontFamily: 'Roboto'), titleLarge: TextStyle(fontFamily: 'Roboto'),
), ),
); );
expect(themeData.textTheme.bodyLarge!.fontFamily, equals('Ahem')); expect(themeData.textTheme.bodyLarge!.fontFamily, equals('FlutterTest'));
expect(themeData.primaryTextTheme.displaySmall!.fontFamily, equals('Ahem')); expect(themeData.primaryTextTheme.displaySmall!.fontFamily, equals('FlutterTest'));
// Shouldn't override the specified style's family // Shouldn't override the specified style's family
expect(themeData.textTheme.titleLarge!.fontFamily, equals('Roboto')); expect(themeData.textTheme.titleLarge!.fontFamily, equals('Roboto'));
......
...@@ -1326,6 +1326,8 @@ void main() { ...@@ -1326,6 +1326,8 @@ void main() {
}); });
testWidgets('ToggleButtons text baseline alignment', (WidgetTester tester) async { testWidgets('ToggleButtons text baseline alignment', (WidgetTester tester) async {
// The point size of the fonts must be a multiple of 4 until
// https://github.com/flutter/flutter/issues/122066 is resolved.
await tester.pumpWidget( await tester.pumpWidget(
Material( Material(
child: boilerplate( child: boilerplate(
...@@ -1337,27 +1339,27 @@ void main() { ...@@ -1337,27 +1339,27 @@ void main() {
borderWidth: 5.0, borderWidth: 5.0,
isSelected: const <bool>[false, true], isSelected: const <bool>[false, true],
children: const <Widget>[ children: const <Widget>[
Text('First child', style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0)), Text('First child', style: TextStyle(fontFamily: 'FlutterTest', fontSize: 8.0)),
Text('Second child', style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0)), Text('Second child', style: TextStyle(fontFamily: 'FlutterTest', fontSize: 8.0)),
], ],
), ),
const MaterialButton( const MaterialButton(
onPressed: null, onPressed: null,
child: Text('Material Button', style: TextStyle(fontFamily: 'Ahem', fontSize: 20.0)), child: Text('Material Button', style: TextStyle(fontFamily: 'FlutterTest', fontSize: 20.0)),
), ),
const Text('Text', style: TextStyle(fontFamily: 'Ahem', fontSize: 30.0)), const Text('Text', style: TextStyle(fontFamily: 'FlutterTest', fontSize: 28.0)),
], ],
), ),
), ),
), ),
); );
// The Ahem font extends 0.2 * fontSize below the baseline. // The test font extends 0.25 * fontSize below the baseline.
// So the three row elements line up like this: // So the three row elements line up like this:
// //
// ToggleButton MaterialButton Text // ToggleButton MaterialButton Text
// ------------------------------------ baseline // ------------------------------------ baseline
// 2 4 6 space below the baseline = 0.2 * fontSize // 2.0 5.0 7.0 space below the baseline = 0.25 * fontSize
// ------------------------------------ widget text dy values // ------------------------------------ widget text dy values
final double firstToggleButtonDy = tester.getBottomLeft(find.text('First child')).dy; final double firstToggleButtonDy = tester.getBottomLeft(find.text('First child')).dy;
...@@ -1366,8 +1368,8 @@ void main() { ...@@ -1366,8 +1368,8 @@ void main() {
final double textDy = tester.getBottomLeft(find.text('Text')).dy; final double textDy = tester.getBottomLeft(find.text('Text')).dy;
expect(firstToggleButtonDy, secondToggleButtonDy); expect(firstToggleButtonDy, secondToggleButtonDy);
expect(firstToggleButtonDy, moreOrLessEquals(materialButtonDy - 2.0, epsilon: 0.001)); expect(firstToggleButtonDy, materialButtonDy - 3.0);
expect(firstToggleButtonDy, moreOrLessEquals(textDy - 4.0, epsilon: 0.001)); expect(firstToggleButtonDy, textDy - 5.0);
}); });
testWidgets('Directionality test', (WidgetTester tester) async { testWidgets('Directionality test', (WidgetTester tester) async {
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
painter.text = const TextSpan( painter.text = const TextSpan(
text: 'ABC DEF\nGHI', text: 'ABC DEF\nGHI',
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
); );
painter.layout(); painter.layout();
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
painter.text = const TextSpan( painter.text = const TextSpan(
text: '${Unicode.RLO}HEBREW1 ${Unicode.LRO}english2${Unicode.PDF} HEBREW3${Unicode.PDF}', text: '${Unicode.RLO}HEBREW1 ${Unicode.LRO}english2${Unicode.PDF} HEBREW3${Unicode.PDF}',
// 0 12345678 9 101234567 18 90123456 27 // 0 12345678 9 101234567 18 90123456 27
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
); );
TextSpan textSpan = painter.text! as TextSpan; TextSpan textSpan = painter.text! as TextSpan;
expect(textSpan.text!.length, 28); expect(textSpan.text!.length, 28);
...@@ -175,7 +175,7 @@ void main() { ...@@ -175,7 +175,7 @@ void main() {
painter.text = const TextSpan( painter.text = const TextSpan(
text: '${Unicode.RLO}HEBREW1 ${Unicode.LRO}english2${Unicode.PDF} HEBREW3${Unicode.PDF}', text: '${Unicode.RLO}HEBREW1 ${Unicode.LRO}english2${Unicode.PDF} HEBREW3${Unicode.PDF}',
// 0 12345678 9 101234567 18 90123456 27 // 0 12345678 9 101234567 18 90123456 27
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
); );
final TextSpan textSpan = painter.text! as TextSpan; final TextSpan textSpan = painter.text! as TextSpan;
expect(textSpan.text!.length, 28); expect(textSpan.text!.length, 28);
...@@ -266,7 +266,7 @@ void main() { ...@@ -266,7 +266,7 @@ void main() {
painter.text = const TextSpan( painter.text = const TextSpan(
text: 'A\u05D0', // A, Alef text: 'A\u05D0', // A, Alef
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
); );
final TextSpan textSpan = painter.text! as TextSpan; final TextSpan textSpan = painter.text! as TextSpan;
expect(textSpan.text!.length, 2); expect(textSpan.text!.length, 2);
...@@ -333,14 +333,14 @@ void main() { ...@@ -333,14 +333,14 @@ void main() {
..textDirection = TextDirection.ltr; ..textDirection = TextDirection.ltr;
painter.text = const TextSpan( painter.text = const TextSpan(
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: 'hello', // width 50 text: 'hello', // width 50
), ),
TextSpan( TextSpan(
text: 'lovely', // width 120 text: 'lovely', // width 120
style: TextStyle(fontFamily: 'Ahem', fontSize: 20.0), style: TextStyle(fontSize: 20.0),
), ),
TextSpan( TextSpan(
text: 'world', // width 50 text: 'world', // width 50
...@@ -368,14 +368,14 @@ void main() { ...@@ -368,14 +368,14 @@ void main() {
..textDirection = TextDirection.ltr; ..textDirection = TextDirection.ltr;
painter.text = const TextSpan( painter.text = const TextSpan(
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: 'hello', // width 50 text: 'hello', // width 50
), ),
TextSpan( TextSpan(
text: '\u062C\u0645\u064A\u0644', // width 80 text: '\u062C\u0645\u064A\u0644', // width 80
style: TextStyle(fontFamily: 'Ahem', fontSize: 20.0), style: TextStyle(fontSize: 20.0),
), ),
TextSpan( TextSpan(
text: 'world', // width 50 text: 'world', // width 50
...@@ -425,14 +425,14 @@ void main() { ...@@ -425,14 +425,14 @@ void main() {
..textDirection = TextDirection.rtl; ..textDirection = TextDirection.rtl;
painter.text = const TextSpan( painter.text = const TextSpan(
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: 'hello', // width 50 text: 'hello', // width 50
), ),
TextSpan( TextSpan(
text: '\u062C\u0645\u064A\u0644', // width 80 text: '\u062C\u0645\u064A\u0644', // width 80
style: TextStyle(fontFamily: 'Ahem', fontSize: 20.0), style: TextStyle(fontSize: 20.0),
), ),
TextSpan( TextSpan(
text: 'world', // width 50 text: 'world', // width 50
...@@ -463,7 +463,7 @@ void main() { ...@@ -463,7 +463,7 @@ void main() {
final String pyramid = rlo(lro(rlo(lro(rlo(''))))); final String pyramid = rlo(lro(rlo(lro(rlo('')))));
painter.text = TextSpan( painter.text = TextSpan(
text: pyramid, text: pyramid,
style: const TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: const TextStyle(fontSize: 10.0),
); );
painter.layout(); painter.layout();
...@@ -494,7 +494,7 @@ void main() { ...@@ -494,7 +494,7 @@ void main() {
painter.text = const TextSpan( painter.text = const TextSpan(
text: 'ABC\u05D0\u05D1\u05D2DEF', // A B C Alef Bet Gimel D E F -- but the Hebrew letters are RTL text: 'ABC\u05D0\u05D1\u05D2DEF', // A B C Alef Bet Gimel D E F -- but the Hebrew letters are RTL
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
); );
painter.layout(); painter.layout();
...@@ -578,7 +578,7 @@ void main() { ...@@ -578,7 +578,7 @@ void main() {
painter.text = const TextSpan( painter.text = const TextSpan(
text: '\u05D0\u05D1\u05D2ABC\u05D3\u05D4\u05D5', text: '\u05D0\u05D1\u05D2ABC\u05D3\u05D4\u05D5',
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
); );
painter.layout(); painter.layout();
...@@ -624,7 +624,7 @@ void main() { ...@@ -624,7 +624,7 @@ void main() {
painter.text = const TextSpan( painter.text = const TextSpan(
text: ' ', text: ' ',
style: TextStyle(fontFamily: 'Ahem', fontSize: 100.0), style: TextStyle(fontSize: 100.0),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: ' ', text: ' ',
...@@ -685,10 +685,10 @@ void main() { ...@@ -685,10 +685,10 @@ void main() {
..textDirection = TextDirection.ltr; ..textDirection = TextDirection.ltr;
painter.text = const TextSpan( painter.text = const TextSpan(
text: '', text: '',
style: TextStyle(fontFamily: 'Ahem', fontSize: 100.0, height: 1.0), style: TextStyle(fontFamily: 'FlutterTest', fontSize: 100.0, height: 1.0),
); );
painter.layout(); painter.layout();
expect(painter.computeDistanceToActualBaseline(TextBaseline.alphabetic), moreOrLessEquals(80.0, epsilon: 0.001)); expect(painter.computeDistanceToActualBaseline(TextBaseline.alphabetic), 75.0);
painter.dispose(); painter.dispose();
}); });
} }
......
...@@ -199,11 +199,7 @@ void main() { ...@@ -199,11 +199,7 @@ void main() {
final TextPainter painter = TextPainter( final TextPainter painter = TextPainter(
text: const TextSpan( text: const TextSpan(
text: 'X', text: 'X',
style: TextStyle( style: TextStyle(inherit: false, fontSize: 123.0),
inherit: false,
fontFamily: 'Ahem',
fontSize: 123.0,
),
), ),
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
); );
...@@ -216,11 +212,7 @@ void main() { ...@@ -216,11 +212,7 @@ void main() {
final TextPainter painter = TextPainter( final TextPainter painter = TextPainter(
text: const TextSpan( text: const TextSpan(
text: 'X', text: 'X',
style: TextStyle( style: TextStyle(inherit: false, fontSize: 10.0),
inherit: false,
fontFamily: 'Ahem',
fontSize: 10.0,
),
), ),
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
textScaleFactor: 2.0, textScaleFactor: 2.0,
...@@ -268,7 +260,6 @@ void main() { ...@@ -268,7 +260,6 @@ void main() {
test('TextPainter intrinsic dimensions', () { test('TextPainter intrinsic dimensions', () {
const TextStyle style = TextStyle( const TextStyle style = TextStyle(
inherit: false, inherit: false,
fontFamily: 'Ahem',
fontSize: 10.0, fontSize: 10.0,
); );
TextPainter painter; TextPainter painter;
......
...@@ -21,9 +21,7 @@ void main() { ...@@ -21,9 +21,7 @@ void main() {
textSelectionDelegate: delegate, textSelectionDelegate: delegate,
text: const TextSpan( text: const TextSpan(
text: 'test', text: 'test',
style: TextStyle( style: TextStyle(height: 1.0, fontSize: 10.0),
height: 1.0, fontSize: 10.0, fontFamily: 'Ahem',
),
), ),
startHandleLayerLink: LayerLink(), startHandleLayerLink: LayerLink(),
endHandleLayerLink: LayerLink(), endHandleLayerLink: LayerLink(),
......
...@@ -148,7 +148,7 @@ void main() { ...@@ -148,7 +148,7 @@ void main() {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
const TextSpan( const TextSpan(
text: 'First ', text: 'First ',
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontFamily: 'FlutterTest', fontSize: 10.0),
children: <InlineSpan>[ children: <InlineSpan>[
TextSpan(text: 'smallsecond ', style: TextStyle(fontSize: 5.0)), TextSpan(text: 'smallsecond ', style: TextStyle(fontSize: 5.0)),
TextSpan(text: 'third fourth fifth'), TextSpan(text: 'third fourth fifth'),
...@@ -175,14 +175,14 @@ void main() { ...@@ -175,14 +175,14 @@ void main() {
// The widths of the boxes should match the calculations above. // The widths of the boxes should match the calculations above.
// The heights should all be 10, except for the box for 'smallsecond ', // The heights should all be 10, except for the box for 'smallsecond ',
// which should have height 5, and be alphabetic baseline-aligned with // which should have height 5, and be alphabetic baseline-aligned with
// 'First '. The Ahem font specifies alphabetic baselines at 0.2em above the // 'First '. The test font specifies alphabetic baselines at 0.25em above
// bottom extent, and 0.8em below the top, so the difference in top // the bottom extent, and 0.75em below the top, so the difference in top
// alignment becomes (10px * 0.8 - 5px * 0.8) = 4px. // alignment becomes (10px * 0.75 - 5px * 0.75) = 3.75px.
// 'First ': // 'First ':
expect(boxes[0], const TextBox.fromLTRBD(0.0, 0.0, 60.0, 10.0, TextDirection.ltr)); expect(boxes[0], const TextBox.fromLTRBD(0.0, 0.0, 60.0, 10.0, TextDirection.ltr));
// 'smallsecond ' in size 5: // 'smallsecond ' in size 5:
expect(boxes[1], const TextBox.fromLTRBD(60.0, 4.0, 120.0, 9.0, TextDirection.ltr)); expect(boxes[1], const TextBox.fromLTRBD(60.0, 3.75, 120.0, 8.75, TextDirection.ltr));
// 'third fourth ': // 'third fourth ':
expect(boxes[2], const TextBox.fromLTRBD(0.0, 10.0, 130.0, 20.0, TextDirection.ltr)); expect(boxes[2], const TextBox.fromLTRBD(0.0, 10.0, 130.0, 20.0, TextDirection.ltr));
// 'fifth': // 'fifth':
...@@ -193,7 +193,7 @@ void main() { ...@@ -193,7 +193,7 @@ void main() {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
const TextSpan( const TextSpan(
text: 'First ', text: 'First ',
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontFamily: 'FlutterTest', fontSize: 10.0),
children: <InlineSpan>[ children: <InlineSpan>[
TextSpan(text: 'smallsecond ', style: TextStyle(fontSize: 8.0)), TextSpan(text: 'smallsecond ', style: TextStyle(fontSize: 8.0)),
TextSpan(text: 'third fourth fifth'), TextSpan(text: 'third fourth fifth'),
...@@ -253,7 +253,7 @@ void main() { ...@@ -253,7 +253,7 @@ void main() {
const TextSpan( const TextSpan(
text: 'This\n' // 4 characters * 10px font size = 40px width on the first line text: 'This\n' // 4 characters * 10px font size = 40px width on the first line
'is a wrapping test. It should wrap at manual newlines, and if softWrap is true, also at spaces.', 'is a wrapping test. It should wrap at manual newlines, and if softWrap is true, also at spaces.',
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
), ),
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
maxLines: 1, maxLines: 1,
...@@ -333,7 +333,7 @@ void main() { ...@@ -333,7 +333,7 @@ void main() {
text: "How do you write like you're running out of time? Write day and night like you're running out of time?", text: "How do you write like you're running out of time? Write day and night like you're running out of time?",
// 0123456789 0123456789 012 345 0123456 012345 01234 012345678 012345678 0123 012 345 0123456 012345 01234 // 0123456789 0123456789 012 345 0123456 012345 01234 012345678 012345678 0123 012 345 0123456 012345 01234
// 0 1 2 3 4 5 6 7 8 9 10 11 12 // 0 1 2 3 4 5 6 7 8 9 10 11 12
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
), ),
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
); );
......
...@@ -11,7 +11,6 @@ void main() { ...@@ -11,7 +11,6 @@ void main() {
const Center( const Center(
child: DefaultTextStyle( child: DefaultTextStyle(
style: TextStyle( style: TextStyle(
fontFamily: 'Ahem',
fontSize: 100.0, fontSize: 100.0,
), ),
child: Text('X', textDirection: TextDirection.ltr), child: Text('X', textDirection: TextDirection.ltr),
...@@ -25,11 +24,11 @@ void main() { ...@@ -25,11 +24,11 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
const Center( const Center(
child: Baseline( child: Baseline(
baseline: 180.0, baseline: 175.0,
baselineType: TextBaseline.alphabetic, baselineType: TextBaseline.alphabetic,
child: DefaultTextStyle( child: DefaultTextStyle(
style: TextStyle( style: TextStyle(
fontFamily: 'Ahem', fontFamily: 'FlutterTest',
fontSize: 100.0, fontSize: 100.0,
), ),
child: Text('X', textDirection: TextDirection.ltr), child: Text('X', textDirection: TextDirection.ltr),
...@@ -40,7 +39,7 @@ void main() { ...@@ -40,7 +39,7 @@ void main() {
expect(tester.renderObject<RenderBox>(find.text('X')).size, const Size(100.0, 100.0)); expect(tester.renderObject<RenderBox>(find.text('X')).size, const Size(100.0, 100.0));
expect( expect(
tester.renderObject<RenderBox>(find.byType(Baseline)).size, tester.renderObject<RenderBox>(find.byType(Baseline)).size,
within<Size>(from: const Size(100.0, 200.0), distance: 0.001), const Size(100.0, 200),
); );
}); });
......
...@@ -454,8 +454,10 @@ void main() { ...@@ -454,8 +454,10 @@ void main() {
testWidgets('multiple baseline aligned children', (WidgetTester tester) async { testWidgets('multiple baseline aligned children', (WidgetTester tester) async {
final UniqueKey key1 = UniqueKey(); final UniqueKey key1 = UniqueKey();
final UniqueKey key2 = UniqueKey(); final UniqueKey key2 = UniqueKey();
const double fontSize1 = 54; // The point size of the font must be a multiple of 4 until
const double fontSize2 = 14; // https://github.com/flutter/flutter/issues/122066 is resolved.
const double fontSize1 = 52;
const double fontSize2 = 12;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -466,11 +468,11 @@ void main() { ...@@ -466,11 +468,11 @@ void main() {
children: <Widget>[ children: <Widget>[
Text('big text', Text('big text',
key: key1, key: key1,
style: const TextStyle(fontSize: fontSize1), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: fontSize1),
), ),
Text('one\ntwo\nthree\nfour\nfive\nsix\nseven', Text('one\ntwo\nthree\nfour\nfive\nsix\nseven',
key: key2, key: key2,
style: const TextStyle(fontSize: fontSize2), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: fontSize2),
), ),
], ],
), ),
...@@ -488,29 +490,28 @@ void main() { ...@@ -488,29 +490,28 @@ void main() {
// lines, but being aligned by the first line's baseline, they hang far // lines, but being aligned by the first line's baseline, they hang far
// below the baseline. The size of the parent row is just enough to // below the baseline. The size of the parent row is just enough to
// contain both of them. // contain both of them.
const double ahemBaselineLocation = 0.8; // https://web-platform-tests.org/writing-tests/ahem.html const double ascentRatio = 0.75;
const double aboveBaseline1 = fontSize1 * ahemBaselineLocation; const double aboveBaseline1 = fontSize1 * ascentRatio;
const double belowBaseline1 = fontSize1 * (1 - ahemBaselineLocation); const double belowBaseline1 = fontSize1 * (1 - ascentRatio);
const double aboveBaseline2 = fontSize2 * ahemBaselineLocation; const double aboveBaseline2 = fontSize2 * ascentRatio;
const double belowBaseline2 = fontSize2 * (1 - ahemBaselineLocation) + fontSize2 * 6; const double belowBaseline2 = fontSize2 * (1 - ascentRatio) + fontSize2 * 6;
final double aboveBaseline = math.max(aboveBaseline1, aboveBaseline2); final double aboveBaseline = math.max(aboveBaseline1, aboveBaseline2);
final double belowBaseline = math.max(belowBaseline1, belowBaseline2); final double belowBaseline = math.max(belowBaseline1, belowBaseline2);
expect(rowBox.size.height, greaterThan(textBox1.size.height)); expect(rowBox.size.height, greaterThan(textBox1.size.height));
expect(rowBox.size.height, greaterThan(textBox2.size.height)); expect(rowBox.size.height, greaterThan(textBox2.size.height));
expect(rowBox.size.height, moreOrLessEquals(aboveBaseline + belowBaseline, epsilon: .001)); expect(rowBox.size.height, aboveBaseline + belowBaseline, );
expect(tester.getTopLeft(find.byKey(key1)).dy, 0); expect(tester.getTopLeft(find.byKey(key1)).dy, 0);
expect( expect(tester.getTopLeft(find.byKey(key2)).dy, aboveBaseline1 - aboveBaseline2);
tester.getTopLeft(find.byKey(key2)).dy,
moreOrLessEquals(aboveBaseline1 - aboveBaseline2, epsilon: .001),
);
}); });
testWidgets('baseline aligned children account for a larger, no-baseline child size', (WidgetTester tester) async { testWidgets('baseline aligned children account for a larger, no-baseline child size', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/58898 // Regression test for https://github.com/flutter/flutter/issues/58898
final UniqueKey key1 = UniqueKey(); final UniqueKey key1 = UniqueKey();
final UniqueKey key2 = UniqueKey(); final UniqueKey key2 = UniqueKey();
const double fontSize1 = 54; // The point size of the font must be a multiple of 4 until
const double fontSize2 = 14; // https://github.com/flutter/flutter/issues/122066 is resolved.
const double fontSize1 = 52;
const double fontSize2 = 12;
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
...@@ -521,11 +522,11 @@ void main() { ...@@ -521,11 +522,11 @@ void main() {
children: <Widget>[ children: <Widget>[
Text('big text', Text('big text',
key: key1, key: key1,
style: const TextStyle(fontSize: fontSize1), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: fontSize1),
), ),
Text('one\ntwo\nthree\nfour\nfive\nsix\nseven', Text('one\ntwo\nthree\nfour\nfive\nsix\nseven',
key: key2, key: key2,
style: const TextStyle(fontSize: fontSize2), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: fontSize2),
), ),
const FlutterLogo(size: 250), const FlutterLogo(size: 250),
], ],
...@@ -544,16 +545,16 @@ void main() { ...@@ -544,16 +545,16 @@ void main() {
// lines, but being aligned by the first line's baseline, they hang far // lines, but being aligned by the first line's baseline, they hang far
// below the baseline. The FlutterLogo extends further than both Texts, // below the baseline. The FlutterLogo extends further than both Texts,
// so the size of the parent row should contain the FlutterLogo as well. // so the size of the parent row should contain the FlutterLogo as well.
const double ahemBaselineLocation = 0.8; // https://web-platform-tests.org/writing-tests/ahem.html const double ascentRatio = 0.75;
const double aboveBaseline1 = fontSize1 * ahemBaselineLocation; const double aboveBaseline1 = fontSize1 * ascentRatio;
const double aboveBaseline2 = fontSize2 * ahemBaselineLocation; const double aboveBaseline2 = fontSize2 * ascentRatio;
expect(rowBox.size.height, greaterThan(textBox1.size.height)); expect(rowBox.size.height, greaterThan(textBox1.size.height));
expect(rowBox.size.height, greaterThan(textBox2.size.height)); expect(rowBox.size.height, greaterThan(textBox2.size.height));
expect(rowBox.size.height, 250); expect(rowBox.size.height, 250);
expect(tester.getTopLeft(find.byKey(key1)).dy, 0); expect(tester.getTopLeft(find.byKey(key1)).dy, 0);
expect( expect(
tester.getTopLeft(find.byKey(key2)).dy, tester.getTopLeft(find.byKey(key2)).dy,
moreOrLessEquals(aboveBaseline1 - aboveBaseline2, epsilon: .001), aboveBaseline1 - aboveBaseline2,
); );
}); });
}); });
......
...@@ -9,7 +9,7 @@ import 'package:flutter/material.dart'; ...@@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
const double _crispText = 100.0; // this font size is selected to avoid needing any antialiasing. const double _crispText = 100.0; // this font size is selected to avoid needing any antialiasing.
const String _expText = 'Éxp'; // renders in Ahem as: const String _expText = 'Éxp'; // renders in the test font as:
// ######## // ########
// ######## // ########
......
...@@ -8,7 +8,6 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -8,7 +8,6 @@ import 'package:flutter_test/flutter_test.dart';
const TextStyle testFont = TextStyle( const TextStyle testFont = TextStyle(
color: Color(0xFF00FF00), color: Color(0xFF00FF00),
fontFamily: 'Ahem',
); );
Future<void> pumpTest(WidgetTester tester, TargetPlatform platform) async { Future<void> pumpTest(WidgetTester tester, TargetPlatform platform) async {
......
...@@ -797,7 +797,7 @@ void main() { ...@@ -797,7 +797,7 @@ void main() {
child: SelectableText( child: SelectableText(
'abc def ghi', 'abc def ghi',
dragStartBehavior: DragStartBehavior.down, dragStartBehavior: DragStartBehavior.down,
style: TextStyle(fontFamily: 'Ahem', fontSize: 10.0), style: TextStyle(fontSize: 10.0),
), ),
), ),
), ),
...@@ -2071,19 +2071,19 @@ void main() { ...@@ -2071,19 +2071,19 @@ void main() {
child: SelectableText( child: SelectableText(
'A', 'A',
key: keyA, key: keyA,
style: const TextStyle(fontSize: 10.0), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 10.0),
strutStyle: StrutStyle.disabled, strutStyle: StrutStyle.disabled,
), ),
), ),
const Text( const Text(
'abc', 'abc',
style: TextStyle(fontSize: 20.0), style: TextStyle(fontFamily: 'FlutterTest', fontSize: 20.0),
), ),
Expanded( Expanded(
child: SelectableText( child: SelectableText(
'B', 'B',
key: keyB, key: keyB,
style: const TextStyle(fontSize: 30.0), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 30.0),
strutStyle: StrutStyle.disabled, strutStyle: StrutStyle.disabled,
), ),
), ),
...@@ -2092,17 +2092,17 @@ void main() { ...@@ -2092,17 +2092,17 @@ void main() {
), ),
); );
// The Ahem font extends 0.2 * fontSize below the baseline. // The test font extends 0.25 * fontSize below the baseline.
// So the three row elements line up like this: // So the three row elements line up like this:
// //
// A abc B // A abc B
// --------- baseline // ------------- baseline
// 2 4 6 space below the baseline = 0.2 * fontSize // 2.5 5 7.5 space below the baseline = 0.25 * fontSize
// --------- rowBottomY // ------------- rowBottomY
final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy; final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy;
expect(tester.getBottomLeft(find.byKey(keyA)).dy, moreOrLessEquals(rowBottomY - 4.0, epsilon: 1e-3)); expect(tester.getBottomLeft(find.byKey(keyA)).dy, rowBottomY - 5.0);
expect(tester.getBottomLeft(find.text('abc')).dy, moreOrLessEquals(rowBottomY - 2.0, epsilon: 1e-3)); expect(tester.getBottomLeft(find.text('abc')).dy, rowBottomY - 2.5);
expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY); expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY);
}); });
...@@ -2120,18 +2120,18 @@ void main() { ...@@ -2120,18 +2120,18 @@ void main() {
child: SelectableText( child: SelectableText(
'A', 'A',
key: keyA, key: keyA,
style: const TextStyle(fontSize: 10.0), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 10.0),
), ),
), ),
const Text( const Text(
'abc', 'abc',
style: TextStyle(fontSize: 20.0), style: TextStyle(fontFamily: 'FlutterTest', fontSize: 20.0),
), ),
Expanded( Expanded(
child: SelectableText( child: SelectableText(
'B', 'B',
key: keyB, key: keyB,
style: const TextStyle(fontSize: 30.0), style: const TextStyle(fontFamily: 'FlutterTest', fontSize: 30.0),
), ),
), ),
], ],
...@@ -2139,17 +2139,17 @@ void main() { ...@@ -2139,17 +2139,17 @@ void main() {
), ),
); );
// The Ahem font extends 0.2 * fontSize below the baseline. // The test font extends 0.25 * fontSize below the baseline.
// So the three row elements line up like this: // So the three row elements line up like this:
// //
// A abc B // A abc B
// --------- baseline // ------------- baseline
// 2 4 6 space below the baseline = 0.2 * fontSize // 2.5 5 7.5 space below the baseline = 0.25 * fontSize
// --------- rowBottomY // ------------- rowBottomY
final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy; final double rowBottomY = tester.getBottomLeft(find.byType(Row)).dy;
expect(tester.getBottomLeft(find.byKey(keyA)).dy, moreOrLessEquals(rowBottomY - 4.0, epsilon: 1e-3)); expect(tester.getBottomLeft(find.byKey(keyA)).dy, rowBottomY - 5.0);
expect(tester.getBottomLeft(find.text('abc')).dy, moreOrLessEquals(rowBottomY - 2.0, epsilon: 1e-3)); expect(tester.getBottomLeft(find.text('abc')).dy, rowBottomY - 2.5);
expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY); expect(tester.getBottomLeft(find.byKey(keyB)).dy, rowBottomY);
}); });
...@@ -2445,7 +2445,7 @@ void main() { ...@@ -2445,7 +2445,7 @@ void main() {
testWidgets('semantic nodes of offscreen recognizers are marked hidden', (WidgetTester tester) async { testWidgets('semantic nodes of offscreen recognizers are marked hidden', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/100395. // Regression test for https://github.com/flutter/flutter/issues/100395.
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem', fontSize: 200); const TextStyle textStyle = TextStyle(fontSize: 200);
const String onScreenText = 'onscreen\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'; const String onScreenText = 'onscreen\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n';
const String offScreenText = 'off screen'; const String offScreenText = 'off screen';
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
......
...@@ -11,7 +11,7 @@ import 'semantics_tester.dart'; ...@@ -11,7 +11,7 @@ import 'semantics_tester.dart';
void main() { void main() {
testWidgets('Semantics tester visits last child', (WidgetTester tester) async { testWidgets('Semantics tester visits last child', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
......
...@@ -1662,7 +1662,7 @@ class FakeEditable extends LeafRenderObjectWidget { ...@@ -1662,7 +1662,7 @@ class FakeEditable extends LeafRenderObjectWidget {
class FakeRenderEditable extends RenderEditable { class FakeRenderEditable extends RenderEditable {
FakeRenderEditable(EditableTextState delegate) : super( FakeRenderEditable(EditableTextState delegate) : super(
text: const TextSpan( text: const TextSpan(
style: TextStyle(height: 1.0, fontSize: 10.0, fontFamily: 'Ahem'), style: TextStyle(height: 1.0, fontSize: 10.0),
text: 'placeholder', text: 'placeholder',
), ),
startHandleLayerLink: LayerLink(), startHandleLayerLink: LayerLink(),
......
...@@ -135,7 +135,7 @@ void main() { ...@@ -135,7 +135,7 @@ void main() {
testWidgets('inline widgets works with ellipsis', (WidgetTester tester) async { testWidgets('inline widgets works with ellipsis', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/35869 // Regression test for https://github.com/flutter/flutter/issues/35869
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
...@@ -168,7 +168,7 @@ void main() { ...@@ -168,7 +168,7 @@ void main() {
testWidgets('inline widgets hitTest works with ellipsis', (WidgetTester tester) async { testWidgets('inline widgets hitTest works with ellipsis', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/68559 // Regression test for https://github.com/flutter/flutter/issues/68559
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
...@@ -514,7 +514,7 @@ void main() { ...@@ -514,7 +514,7 @@ void main() {
testWidgets('recognizers split semantic node', (WidgetTester tester) async { testWidgets('recognizers split semantic node', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
...@@ -569,7 +569,7 @@ void main() { ...@@ -569,7 +569,7 @@ void main() {
testWidgets('semantic nodes of offscreen recognizers are marked hidden', (WidgetTester tester) async { testWidgets('semantic nodes of offscreen recognizers are marked hidden', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/100395. // Regression test for https://github.com/flutter/flutter/issues/100395.
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem', fontSize: 200); const TextStyle textStyle = TextStyle(fontSize: 200);
const String onScreenText = 'onscreen\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'; const String onScreenText = 'onscreen\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n';
const String offScreenText = 'off screen'; const String offScreenText = 'off screen';
final ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
...@@ -637,7 +637,7 @@ void main() { ...@@ -637,7 +637,7 @@ void main() {
testWidgets('recognizers split semantic node when TextSpan overflows', (WidgetTester tester) async { testWidgets('recognizers split semantic node when TextSpan overflows', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
SizedBox( SizedBox(
height: 10, height: 10,
...@@ -688,7 +688,7 @@ void main() { ...@@ -688,7 +688,7 @@ void main() {
testWidgets('recognizers split semantic nodes with text span labels', (WidgetTester tester) async { testWidgets('recognizers split semantic nodes with text span labels', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
...@@ -746,7 +746,7 @@ void main() { ...@@ -746,7 +746,7 @@ void main() {
testWidgets('recognizers split semantic node - bidi', (WidgetTester tester) async { testWidgets('recognizers split semantic node - bidi', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
RichText( RichText(
text: TextSpan( text: TextSpan(
...@@ -827,7 +827,7 @@ void main() { ...@@ -827,7 +827,7 @@ void main() {
testWidgets('TapGesture recognizers contribute link semantics', (WidgetTester tester) async { testWidgets('TapGesture recognizers contribute link semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
...@@ -867,7 +867,7 @@ void main() { ...@@ -867,7 +867,7 @@ void main() {
testWidgets('inline widgets generate semantic nodes', (WidgetTester tester) async { testWidgets('inline widgets generate semantic nodes', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
...@@ -941,7 +941,7 @@ void main() { ...@@ -941,7 +941,7 @@ void main() {
testWidgets('inline widgets semantic nodes scale', (WidgetTester tester) async { testWidgets('inline widgets semantic nodes scale', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
const TextStyle textStyle = TextStyle(fontFamily: 'Ahem'); const TextStyle textStyle = TextStyle();
await tester.pumpWidget( await tester.pumpWidget(
Text.rich( Text.rich(
TextSpan( TextSpan(
......
...@@ -793,11 +793,11 @@ void main() { ...@@ -793,11 +793,11 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
const Center( const Center(
child: Baseline( child: Baseline(
baseline: 180.0, baseline: 175.0,
baselineType: TextBaseline.alphabetic, baselineType: TextBaseline.alphabetic,
child: DefaultTextStyle( child: DefaultTextStyle(
style: TextStyle( style: TextStyle(
fontFamily: 'Ahem', fontFamily: 'FlutterTest',
fontSize: 100.0, fontSize: 100.0,
), ),
child: Wrap( child: Wrap(
...@@ -813,7 +813,7 @@ void main() { ...@@ -813,7 +813,7 @@ void main() {
expect(tester.renderObject<RenderBox>(find.text('X')).size, const Size(100.0, 100.0)); expect(tester.renderObject<RenderBox>(find.text('X')).size, const Size(100.0, 100.0));
expect( expect(
tester.renderObject<RenderBox>(find.byType(Baseline)).size, tester.renderObject<RenderBox>(find.byType(Baseline)).size,
within<Size>(from: const Size(100.0, 200.0), distance: 0.001), const Size(100.0, 200.0),
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment