|
|
|
|
@@ -380,7 +380,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)),
|
|
|
|
|
const Size(200, 29), // 29 is the height of the default font + padding etc.
|
|
|
|
|
const Size(200, 31), // 31 is the height of the default font + padding etc.
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -401,7 +401,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)),
|
|
|
|
|
const Size(200, 29), // 29 is the height of the default font (17) + decoration (12).
|
|
|
|
|
const Size(200, 31), // 31 is the height of the default font (17) + decoration (12).
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -508,7 +508,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)),
|
|
|
|
|
const Size(200, 63), // 63 is the height of the default font (17) * maxlines (3) + decoration height (12).
|
|
|
|
|
const Size(200, 65), // 65 is the height of the default font (17) * maxlines (3) + decoration height (12).
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -529,7 +529,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)),
|
|
|
|
|
const Size(200, 63),
|
|
|
|
|
const Size(200, 65),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -556,7 +556,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)),
|
|
|
|
|
const Size(200, 36),
|
|
|
|
|
const Size(200, 38),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
// TODO(mdebbar): Strut styles support.
|
|
|
|
|
@@ -586,7 +586,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)),
|
|
|
|
|
const Size(200, 66),
|
|
|
|
|
const Size(200, 68),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
// TODO(mdebbar): Strut styles support.
|
|
|
|
|
@@ -686,7 +686,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopLeft(find.text('initial')) - tester.getTopLeft(find.byType(CupertinoTextField)),
|
|
|
|
|
const Offset(6.0, 6.0),
|
|
|
|
|
const Offset(7.0, 7.0),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -913,7 +913,7 @@ void main() {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byIcon(CupertinoIcons.add)).dx + 6.0, // 6px standard padding around input.
|
|
|
|
|
tester.getTopRight(find.byIcon(CupertinoIcons.add)).dx + 7.0, // 7px standard padding around input.
|
|
|
|
|
tester.getTopLeft(find.byType(EditableText)).dx,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@@ -921,7 +921,7 @@ void main() {
|
|
|
|
|
tester.getTopLeft(find.byType(EditableText)).dx,
|
|
|
|
|
tester.getTopLeft(find.byType(CupertinoTextField)).dx
|
|
|
|
|
+ tester.getSize(find.byIcon(CupertinoIcons.add)).width
|
|
|
|
|
+ 6.0,
|
|
|
|
|
+ 7.0,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -944,7 +944,7 @@ void main() {
|
|
|
|
|
// The position should just be the edge of the whole text field plus padding.
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopLeft(find.byType(EditableText)).dx,
|
|
|
|
|
tester.getTopLeft(find.byType(CupertinoTextField)).dx + 6.0,
|
|
|
|
|
tester.getTopLeft(find.byType(CupertinoTextField)).dx + 7.0,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.enterText(find.byType(CupertinoTextField), 'text input');
|
|
|
|
|
@@ -958,7 +958,7 @@ void main() {
|
|
|
|
|
tester.getTopLeft(find.byType(EditableText)).dx,
|
|
|
|
|
tester.getTopLeft(find.byType(CupertinoTextField)).dx
|
|
|
|
|
+ tester.getSize(find.byIcon(CupertinoIcons.add)).width
|
|
|
|
|
+ 6.0,
|
|
|
|
|
+ 7.0,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -979,15 +979,15 @@ void main() {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx + 6.0,
|
|
|
|
|
tester.getTopLeft(find.byIcon(CupertinoIcons.add)).dx, // 6px standard padding around input.
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx + 7.0,
|
|
|
|
|
tester.getTopLeft(find.byIcon(CupertinoIcons.add)).dx, // 7px standard padding around input.
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx,
|
|
|
|
|
tester.getTopRight(find.byType(CupertinoTextField)).dx
|
|
|
|
|
- tester.getSize(find.byIcon(CupertinoIcons.add)).width
|
|
|
|
|
- 6.0,
|
|
|
|
|
- 7.0,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -1170,7 +1170,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx,
|
|
|
|
|
800.0 - 30.0 /* size of button */ - 6.0 /* padding */,
|
|
|
|
|
800.0 - 30.0 /* size of button */ - 7.0 /* padding */,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
@@ -1188,7 +1188,7 @@ void main() {
|
|
|
|
|
expect(find.byIcon(CupertinoIcons.clear_thick_circled), findsNothing);
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx,
|
|
|
|
|
800.0 - 6.0 /* padding */,
|
|
|
|
|
800.0 - 7.0 /* padding */,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.enterText(find.byType(CupertinoTextField), 'text input');
|
|
|
|
|
@@ -1198,7 +1198,7 @@ void main() {
|
|
|
|
|
expect(find.text('text input'), findsOneWidget);
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx,
|
|
|
|
|
800.0 - 30.0 - 6.0,
|
|
|
|
|
800.0 - 30.0 - 7.0,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
@@ -1302,7 +1302,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx,
|
|
|
|
|
800.0 - 30.0 /* size of button */ - 6.0 /* padding */,
|
|
|
|
|
800.0 - 30.0 /* size of button */ - 7.0 /* padding */,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
controller.text = 'non empty text';
|
|
|
|
|
@@ -1314,7 +1314,7 @@ void main() {
|
|
|
|
|
// Still just takes the space of one widget.
|
|
|
|
|
expect(
|
|
|
|
|
tester.getTopRight(find.byType(EditableText)).dx,
|
|
|
|
|
800.0 - 24.0 /* size of button */ - 6.0 /* padding */,
|
|
|
|
|
800.0 - 24.0 /* size of button */ - 7.0 /* padding */,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -1334,7 +1334,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
29.0,
|
|
|
|
|
31.0,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
@@ -1353,7 +1353,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
62.0,
|
|
|
|
|
64.0,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -1371,7 +1371,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
29.0,
|
|
|
|
|
31.0,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.pumpWidget(
|
|
|
|
|
@@ -1389,7 +1389,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
62.0,
|
|
|
|
|
64.0,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -1440,7 +1440,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
29.0, // Initially one line high.
|
|
|
|
|
31.0, // Initially one line high.
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.enterText(find.byType(CupertinoTextField), '\n');
|
|
|
|
|
@@ -1448,7 +1448,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
46.0, // Initially one line high.
|
|
|
|
|
48.0, // Initially one line high.
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -1468,7 +1468,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
29.0, // Initially one line high.
|
|
|
|
|
31.0, // Initially one line high.
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await tester.enterText(find.byType(CupertinoTextField), '\n');
|
|
|
|
|
@@ -1476,7 +1476,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
|
tester.getSize(find.byType(CupertinoTextField)).height,
|
|
|
|
|
46.0, // Initially one line high.
|
|
|
|
|
48.0, // Initially one line high.
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@@ -3001,14 +3001,14 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(lastCharEndpoint.length, 1);
|
|
|
|
|
// The last character is now on screen near the right edge.
|
|
|
|
|
expect(lastCharEndpoint[0].point.dx, moreOrLessEquals(786.73, epsilon: 1));
|
|
|
|
|
expect(lastCharEndpoint[0].point.dx, moreOrLessEquals(785.40, epsilon: 1));
|
|
|
|
|
|
|
|
|
|
final List<TextSelectionPoint> firstCharEndpoint = renderEditable.getEndpointsForSelection(
|
|
|
|
|
const TextSelection.collapsed(offset: 0), // First character's position.
|
|
|
|
|
);
|
|
|
|
|
expect(firstCharEndpoint.length, 1);
|
|
|
|
|
// The first character is now offscreen to the left.
|
|
|
|
|
expect(firstCharEndpoint[0].point.dx, moreOrLessEquals(-308.20, epsilon: 1));
|
|
|
|
|
expect(firstCharEndpoint[0].point.dx, moreOrLessEquals(-309.30, epsilon: 1));
|
|
|
|
|
}, variant: TargetPlatformVariant.all(excluding: <TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
|
|
|
|
|
|
|
|
|
|
testWidgets('long press drag can edge scroll on Apple platforms', (WidgetTester tester) async {
|
|
|
|
|
@@ -3098,14 +3098,14 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect(lastCharEndpoint.length, 1);
|
|
|
|
|
// The last character is now on screen.
|
|
|
|
|
expect(lastCharEndpoint[0].point.dx, moreOrLessEquals(786.73, epsilon: 0.25));
|
|
|
|
|
expect(lastCharEndpoint[0].point.dx, moreOrLessEquals(784.73, epsilon: 0.25));
|
|
|
|
|
|
|
|
|
|
final List<TextSelectionPoint> firstCharEndpoint = renderEditable.getEndpointsForSelection(
|
|
|
|
|
const TextSelection.collapsed(offset: 0), // First character's position.
|
|
|
|
|
);
|
|
|
|
|
expect(firstCharEndpoint.length, 1);
|
|
|
|
|
// The first character is now offscreen to the left.
|
|
|
|
|
expect(firstCharEndpoint[0].point.dx, moreOrLessEquals(-308.20, epsilon: 0.25));
|
|
|
|
|
expect(firstCharEndpoint[0].point.dx, moreOrLessEquals(-310.20, epsilon: 0.25));
|
|
|
|
|
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
|
|
|
|
|
|
|
|
|
|
testWidgets(
|
|
|
|
|
@@ -4608,7 +4608,7 @@ void main() {
|
|
|
|
|
child: ListView(
|
|
|
|
|
controller: scrollController,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(height: 585), // Push field almost off screen.
|
|
|
|
|
Container(height: 583), // Push field almost off screen.
|
|
|
|
|
CupertinoTextField(controller: controller),
|
|
|
|
|
Container(height: 1000),
|
|
|
|
|
],
|
|
|
|
|
@@ -4623,7 +4623,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
// The ListView has scrolled to keep the TextField and cursor handle
|
|
|
|
|
// visible.
|
|
|
|
|
expect(scrollController.offset, 26.0);
|
|
|
|
|
expect(scrollController.offset, 25.0);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testWidgets('disabled state golden', (WidgetTester tester) async {
|
|
|
|
|
@@ -5126,7 +5126,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
// The EditableText is at the top.
|
|
|
|
|
expect(tester.getTopLeft(find.byType(CupertinoTextField)).dy, moreOrLessEquals(size.height, epsilon: .0001));
|
|
|
|
|
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(206.0, epsilon: .0001));
|
|
|
|
|
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(207.0, epsilon: .0001));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testWidgets('align center', (WidgetTester tester) async {
|
|
|
|
|
@@ -5220,7 +5220,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
// The EditableText is at the bottom.
|
|
|
|
|
expect(tester.getTopLeft(find.byType(CupertinoTextField)).dy, moreOrLessEquals(size.height, epsilon: .0001));
|
|
|
|
|
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(377.0, epsilon: .0001));
|
|
|
|
|
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(376.0, epsilon: .0001));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
testWidgets('align as a double', (WidgetTester tester) async {
|
|
|
|
|
@@ -5267,7 +5267,7 @@ void main() {
|
|
|
|
|
|
|
|
|
|
// The EditableText is near the bottom.
|
|
|
|
|
expect(tester.getTopLeft(find.byType(CupertinoTextField)).dy, moreOrLessEquals(size.height, epsilon: .0001));
|
|
|
|
|
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(355.625, epsilon: .0001));
|
|
|
|
|
expect(tester.getTopLeft(find.byType(EditableText)).dy, moreOrLessEquals(354.875, epsilon: .0001));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|