Commit 04e892a4 authored by Phil Quitslund's avatar Phil Quitslund

Merge pull request #3729 from pq/annotate_literals_2

More type annotations for literals.
parents e365453e 8bc06aa9
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'expression.dart'; import 'expression.dart';
import 'equation_member.dart'; import 'equation_member.dart';
import 'term.dart';
class ConstantMember extends EquationMember { class ConstantMember extends EquationMember {
/// Creates a [ConstantMember] object. /// Creates a [ConstantMember] object.
...@@ -13,7 +14,7 @@ class ConstantMember extends EquationMember { ...@@ -13,7 +14,7 @@ class ConstantMember extends EquationMember {
ConstantMember(this.value); ConstantMember(this.value);
@override @override
Expression asExpression() => new Expression([], this.value); Expression asExpression() => new Expression(<Term>[], this.value);
@override @override
final double value; final double value;
......
...@@ -156,7 +156,7 @@ class Expression extends EquationMember { ...@@ -156,7 +156,7 @@ class Expression extends EquationMember {
EquationMember operator /(EquationMember m) { EquationMember operator /(EquationMember m) {
if (!m.isConstant) { if (!m.isConstant) {
throw new ParserException( throw new ParserException(
'The divisor was not a constant expression', [this, m]); 'The divisor was not a constant expression', <EquationMember>[this, m]);
return null; return null;
} }
......
...@@ -250,7 +250,7 @@ class Solver { ...@@ -250,7 +250,7 @@ class Solver {
return Result.badRequiredStrength; return Result.badRequiredStrength;
Constraint constraint = new Constraint( Constraint constraint = new Constraint(
new Expression([new Term(variable, 1.0)], 0.0), new Expression(<Term>[new Term(variable, 1.0)], 0.0),
Relation.equalTo Relation.equalTo
); );
constraint.priority = priority; constraint.priority = priority;
......
...@@ -15,7 +15,7 @@ class Term extends EquationMember { ...@@ -15,7 +15,7 @@ class Term extends EquationMember {
@override @override
Expression asExpression() => Expression asExpression() =>
new Expression([new Term(this.variable, this.coefficient)], 0.0); new Expression(<Term>[new Term(this.variable, this.coefficient)], 0.0);
@override @override
bool get isConstant => false; bool get isConstant => false;
......
...@@ -239,7 +239,7 @@ abstract class BindingBase { ...@@ -239,7 +239,7 @@ abstract class BindingBase {
)); ));
return new developer.ServiceExtensionResponse.error( return new developer.ServiceExtensionResponse.error(
developer.ServiceExtensionResponse.extensionError, developer.ServiceExtensionResponse.extensionError,
JSON.encode({ JSON.encode(<String, dynamic>{
'exception': caughtException.toString(), 'exception': caughtException.toString(),
'stack': caughtStack.toString(), 'stack': caughtStack.toString(),
'method': method 'method': method
......
...@@ -10,7 +10,7 @@ class Response { ...@@ -10,7 +10,7 @@ class Response {
/// Creates a [Response] object with the given fields. /// Creates a [Response] object with the given fields.
/// ///
/// If [bodyBytes] is non-null, it is used to populate [body]. /// If [bodyBytes] is non-null, it is used to populate [body].
Response.bytes(this.bodyBytes, this.statusCode, { this.headers: const {} }); Response.bytes(this.bodyBytes, this.statusCode, { this.headers: const <String, String>{} });
/// The result of decoding [bodyBytes] using ISO-8859-1. /// The result of decoding [bodyBytes] using ISO-8859-1.
/// ///
......
...@@ -221,7 +221,7 @@ class _InputState extends State<Input> { ...@@ -221,7 +221,7 @@ class _InputState extends State<Input> {
double iconTop = topPadding + (textStyle.fontSize - iconSize) / 2.0; double iconTop = topPadding + (textStyle.fontSize - iconSize) / 2.0;
child = new Row( child = new Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: <Widget>[
new Container( new Container(
margin: new EdgeInsets.only(right: 16.0, top: iconTop), margin: new EdgeInsets.only(right: 16.0, top: iconTop),
width: config.isDense ? 40.0 : 48.0, width: config.isDense ? 40.0 : 48.0,
......
...@@ -281,12 +281,12 @@ List<TextPainter> _initPainters(List<String> labels) { ...@@ -281,12 +281,12 @@ List<TextPainter> _initPainters(List<String> labels) {
} }
List<TextPainter> _initHours() { List<TextPainter> _initHours() {
return _initPainters(['12', '1', '2', '3', '4', '5', return _initPainters(<String>['12', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '10', '11']); '6', '7', '8', '9', '10', '11']);
} }
List<TextPainter> _initMinutes() { List<TextPainter> _initMinutes() {
return _initPainters(['00', '05', '10', '15', '20', '25', return _initPainters(<String>['00', '05', '10', '15', '20', '25',
'30', '35', '40', '45', '50', '55']); '30', '35', '40', '45', '50', '55']);
} }
......
...@@ -129,12 +129,12 @@ class RenderEditableLine extends RenderBox { ...@@ -129,12 +129,12 @@ class RenderEditableLine extends RenderBox {
// TODO(mpcomplete): This doesn't work well at an RTL/LTR boundary. // TODO(mpcomplete): This doesn't work well at an RTL/LTR boundary.
Offset caretOffset = _textPainter.getOffsetForCaret(selection.extent, _caretPrototype); Offset caretOffset = _textPainter.getOffsetForCaret(selection.extent, _caretPrototype);
Point start = new Point(caretOffset.dx, _contentSize.height) + offset; Point start = new Point(caretOffset.dx, _contentSize.height) + offset;
return [new TextSelectionPoint(localToGlobal(start), null)]; return <TextSelectionPoint>[new TextSelectionPoint(localToGlobal(start), null)];
} else { } else {
List<ui.TextBox> boxes = _textPainter.getBoxesForSelection(selection); List<ui.TextBox> boxes = _textPainter.getBoxesForSelection(selection);
Point start = new Point(boxes.first.start, boxes.first.bottom) + offset; Point start = new Point(boxes.first.start, boxes.first.bottom) + offset;
Point end = new Point(boxes.last.end, boxes.last.bottom) + offset; Point end = new Point(boxes.last.end, boxes.last.bottom) + offset;
return [ return <TextSelectionPoint>[
new TextSelectionPoint(localToGlobal(start), boxes.first.direction), new TextSelectionPoint(localToGlobal(start), boxes.first.direction),
new TextSelectionPoint(localToGlobal(end), boxes.last.direction), new TextSelectionPoint(localToGlobal(end), boxes.last.direction),
]; ];
......
...@@ -54,50 +54,50 @@ void main() { ...@@ -54,50 +54,50 @@ void main() {
valueLog.add(controller.value); valueLog.add(controller.value);
}); });
expect(log, equals([])); expect(log, equals(<AnimationStatus>[]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
controller.forward(); controller.forward();
expect(log, equals([AnimationStatus.forward])); expect(log, equals(<AnimationStatus>[AnimationStatus.forward]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
controller.reverse(); controller.reverse();
expect(log, equals([AnimationStatus.forward, AnimationStatus.dismissed])); expect(log, equals(<AnimationStatus>[AnimationStatus.forward, AnimationStatus.dismissed]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
controller.reverse(); controller.reverse();
expect(log, equals([AnimationStatus.forward, AnimationStatus.dismissed])); expect(log, equals(<AnimationStatus>[AnimationStatus.forward, AnimationStatus.dismissed]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
log.clear(); log.clear();
controller.forward(); controller.forward();
expect(log, equals([AnimationStatus.forward])); expect(log, equals(<AnimationStatus>[AnimationStatus.forward]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
controller.forward(); controller.forward();
expect(log, equals([AnimationStatus.forward])); expect(log, equals(<AnimationStatus>[AnimationStatus.forward]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
controller.reverse(); controller.reverse();
log.clear(); log.clear();
WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 10)); WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 10));
expect(log, equals([])); expect(log, equals(<AnimationStatus>[]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 20)); WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 20));
expect(log, equals([])); expect(log, equals(<AnimationStatus>[]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 30)); WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 30));
expect(log, equals([])); expect(log, equals(<AnimationStatus>[]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 40)); WidgetsBinding.instance.handleBeginFrame(const Duration(seconds: 40));
expect(log, equals([])); expect(log, equals(<AnimationStatus>[]));
expect(valueLog, equals([])); expect(valueLog, equals(<AnimationStatus>[]));
controller.stop(); controller.stop();
}); });
...@@ -118,15 +118,15 @@ void main() { ...@@ -118,15 +118,15 @@ void main() {
}); });
controller.reverse(from: 0.2); controller.reverse(from: 0.2);
expect(statusLog, equals([ AnimationStatus.reverse ])); expect(statusLog, equals(<AnimationStatus>[ AnimationStatus.reverse ]));
expect(valueLog, equals([ 0.2 ])); expect(valueLog, equals(<double>[ 0.2 ]));
expect(controller.value, equals(0.2)); expect(controller.value, equals(0.2));
statusLog.clear(); statusLog.clear();
valueLog.clear(); valueLog.clear();
controller.forward(from: 0.0); controller.forward(from: 0.0);
expect(statusLog, equals([ AnimationStatus.dismissed, AnimationStatus.forward ])); expect(statusLog, equals(<AnimationStatus>[ AnimationStatus.dismissed, AnimationStatus.forward ]));
expect(valueLog, equals([ 0.0 ])); expect(valueLog, equals(<double>[ 0.0 ]));
expect(controller.value, equals(0.0)); expect(controller.value, equals(0.0));
}); });
} }
...@@ -210,7 +210,7 @@ void main() { ...@@ -210,7 +210,7 @@ void main() {
expect((t * cm(2.0)).value, 40.0); expect((t * cm(2.0)).value, 40.0);
// Expression // Expression
Expression e = new Expression([t], 0.0); Expression e = new Expression(<Term>[t], 0.0);
expect((e * cm(2.0)).value, 40.0); expect((e * cm(2.0)).value, 40.0);
}); });
...@@ -228,7 +228,7 @@ void main() { ...@@ -228,7 +228,7 @@ void main() {
expect((t / cm(2.0)).value, 10.0); expect((t / cm(2.0)).value, 10.0);
// Expression // Expression
Expression e = new Expression([t], 0.0); Expression e = new Expression(<Term>[t], 0.0);
expect((e / cm(2.0)).value, 10.0); expect((e / cm(2.0)).value, 10.0);
}); });
...@@ -298,7 +298,7 @@ void main() { ...@@ -298,7 +298,7 @@ void main() {
expect(c3.expression.constant, 0.0); expect(c3.expression.constant, 0.0);
// Expression // Expression
Constraint c4 = e >= new Expression([new Term(new Variable(2.0), 1.0)], 20.0); Constraint c4 = e >= new Expression(<Term>[new Term(new Variable(2.0), 1.0)], 20.0);
expect(c4 is Constraint, true); expect(c4 is Constraint, true);
expect(c4.expression.terms.length, 3); expect(c4.expression.terms.length, 3);
expect(c4.expression.constant, -20.0); expect(c4.expression.constant, -20.0);
...@@ -325,8 +325,8 @@ void main() { ...@@ -325,8 +325,8 @@ void main() {
expect(c3.expression.constant, 0.0); expect(c3.expression.constant, 0.0);
// Expression // Expression
Expression e = new Expression([t], 0.0); Expression e = new Expression(<Term>[t], 0.0);
Constraint c4 = e >= new Expression([new Term(new Variable(2.0), 1.0)], 20.0); Constraint c4 = e >= new Expression(<Term>[new Term(new Variable(2.0), 1.0)], 20.0);
expect(c4 is Constraint, true); expect(c4 is Constraint, true);
expect(c4.expression.terms.length, 2); expect(c4.expression.terms.length, 2);
expect(c4.expression.constant, -20.0); expect(c4.expression.constant, -20.0);
...@@ -352,7 +352,7 @@ void main() { ...@@ -352,7 +352,7 @@ void main() {
ConstantMember c = cm(10.0); ConstantMember c = cm(10.0);
Param v = new Param(c.value); Param v = new Param(c.value);
Term t = new Term(v.variable, 1.0); Term t = new Term(v.variable, 1.0);
Expression e = new Expression([t], 0.0); Expression e = new Expression(<Term>[t], 0.0);
// Constant // Constant
expect((c * cm(10.0)).value, 100); expect((c * cm(10.0)).value, 100);
...@@ -383,7 +383,7 @@ void main() { ...@@ -383,7 +383,7 @@ void main() {
ConstantMember c = cm(10.0); ConstantMember c = cm(10.0);
Param v = new Param(c.value); Param v = new Param(c.value);
Term t = new Term(v.variable, 1.0); Term t = new Term(v.variable, 1.0);
Expression e = new Expression([t], 0.0); Expression e = new Expression(<Term>[t], 0.0);
expect((c * c).value, 100); expect((c * c).value, 100);
expect(() => v * v, throwsA(new isInstanceOf<ParserException>())); expect(() => v * v, throwsA(new isInstanceOf<ParserException>()));
...@@ -457,13 +457,13 @@ void main() { ...@@ -457,13 +457,13 @@ void main() {
Constraint c = (left >= cm(0.0)); Constraint c = (left >= cm(0.0));
expect(s.addConstraints([ expect(s.addConstraints(<Constraint>[
(left + right).equals(cm(2.0) * mid), (left + right).equals(cm(2.0) * mid),
(right - left >= cm(100.0)), (right - left >= cm(100.0)),
c c
]), Result.success); ]), Result.success);
expect(s.addConstraints([(right >= cm(-20.0)), c]), expect(s.addConstraints(<Constraint>[(right >= cm(-20.0)), c]),
Result.duplicateConstraint); Result.duplicateConstraint);
}); });
...@@ -599,7 +599,7 @@ void main() { ...@@ -599,7 +599,7 @@ void main() {
Param mid = new Param(0.0); Param mid = new Param(0.0);
expect(s.addEditVariables( expect(s.addEditVariables(
[left.variable, right.variable, mid.variable], 999.0), Result.success); <Variable>[left.variable, right.variable, mid.variable], 999.0), Result.success);
}); });
test('bulk_remove_constraints_and_variables', () { test('bulk_remove_constraints_and_variables', () {
...@@ -610,16 +610,16 @@ void main() { ...@@ -610,16 +610,16 @@ void main() {
Param mid = new Param(0.0); Param mid = new Param(0.0);
expect(s.addEditVariables( expect(s.addEditVariables(
[left.variable, right.variable, mid.variable], 999.0), Result.success); <Variable>[left.variable, right.variable, mid.variable], 999.0), Result.success);
Constraint c1 = left <= mid; Constraint c1 = left <= mid;
Constraint c2 = mid <= right; Constraint c2 = mid <= right;
expect(s.addConstraints([c1, c2]), Result.success); expect(s.addConstraints(<Constraint>[c1, c2]), Result.success);
expect(s.removeConstraints([c1, c2]), Result.success); expect(s.removeConstraints(<Constraint>[c1, c2]), Result.success);
expect(s.removeEditVariables( expect(s.removeEditVariables(
[left.variable, right.variable, mid.variable]), Result.success); <Variable>[left.variable, right.variable, mid.variable]), Result.success);
}); });
} }
...@@ -31,14 +31,14 @@ void main() { ...@@ -31,14 +31,14 @@ void main() {
) )
) )
); );
expect(log, equals(['getClip'])); expect(log, equals(<String>['getClip']));
tester.tapAt(new Point(10.0, 10.0)); tester.tapAt(new Point(10.0, 10.0));
expect(log, equals(['getClip'])); expect(log, equals(<String>['getClip']));
log.clear(); log.clear();
tester.tapAt(new Point(100.0, 100.0)); tester.tapAt(new Point(100.0, 100.0));
expect(log, equals(['tap'])); expect(log, equals(<String>['tap']));
log.clear(); log.clear();
}); });
...@@ -52,14 +52,14 @@ void main() { ...@@ -52,14 +52,14 @@ void main() {
) )
) )
); );
expect(log, equals([])); expect(log, equals(<String>[]));
tester.tapAt(new Point(10.0, 10.0)); tester.tapAt(new Point(10.0, 10.0));
expect(log, equals([])); expect(log, equals(<String>[]));
log.clear(); log.clear();
tester.tapAt(new Point(400.0, 300.0)); tester.tapAt(new Point(400.0, 300.0));
expect(log, equals(['tap'])); expect(log, equals(<String>['tap']));
log.clear(); log.clear();
}); });
} }
...@@ -41,6 +41,6 @@ void main() { ...@@ -41,6 +41,6 @@ void main() {
) )
)); ));
expect(log, equals(['background', 'child', 'foreground'])); expect(log, equals(<String>['background', 'child', 'foreground']));
}); });
} }
...@@ -139,12 +139,12 @@ void main() { ...@@ -139,12 +139,12 @@ void main() {
dismissItem(tester, 0, gestureDirection: DismissDirection.startToEnd); dismissItem(tester, 0, gestureDirection: DismissDirection.startToEnd);
expect(find.text('0'), findsNothing); expect(find.text('0'), findsNothing);
expect(dismissedItems, equals([0])); expect(dismissedItems, equals(<int>[0]));
expect(reportedDismissDirection, DismissDirection.startToEnd); expect(reportedDismissDirection, DismissDirection.startToEnd);
dismissItem(tester, 1, gestureDirection: DismissDirection.endToStart); dismissItem(tester, 1, gestureDirection: DismissDirection.endToStart);
expect(find.text('1'), findsNothing); expect(find.text('1'), findsNothing);
expect(dismissedItems, equals([0, 1])); expect(dismissedItems, equals(<int>[0, 1]));
expect(reportedDismissDirection, DismissDirection.endToStart); expect(reportedDismissDirection, DismissDirection.endToStart);
}); });
...@@ -157,12 +157,12 @@ void main() { ...@@ -157,12 +157,12 @@ void main() {
dismissItem(tester, 0, gestureDirection: DismissDirection.up); dismissItem(tester, 0, gestureDirection: DismissDirection.up);
expect(find.text('0'), findsNothing); expect(find.text('0'), findsNothing);
expect(dismissedItems, equals([0])); expect(dismissedItems, equals(<int>[0]));
expect(reportedDismissDirection, DismissDirection.up); expect(reportedDismissDirection, DismissDirection.up);
dismissItem(tester, 1, gestureDirection: DismissDirection.down); dismissItem(tester, 1, gestureDirection: DismissDirection.down);
expect(find.text('1'), findsNothing); expect(find.text('1'), findsNothing);
expect(dismissedItems, equals([0, 1])); expect(dismissedItems, equals(<int>[0, 1]));
expect(reportedDismissDirection, DismissDirection.down); expect(reportedDismissDirection, DismissDirection.down);
}); });
...@@ -180,7 +180,7 @@ void main() { ...@@ -180,7 +180,7 @@ void main() {
dismissItem(tester, 0, gestureDirection: DismissDirection.endToStart); dismissItem(tester, 0, gestureDirection: DismissDirection.endToStart);
expect(find.text('0'), findsNothing); expect(find.text('0'), findsNothing);
expect(dismissedItems, equals([0])); expect(dismissedItems, equals(<int>[0]));
dismissItem(tester, 1, gestureDirection: DismissDirection.endToStart); dismissItem(tester, 1, gestureDirection: DismissDirection.endToStart);
}); });
...@@ -197,7 +197,7 @@ void main() { ...@@ -197,7 +197,7 @@ void main() {
dismissItem(tester, 0, gestureDirection: DismissDirection.startToEnd); dismissItem(tester, 0, gestureDirection: DismissDirection.startToEnd);
expect(find.text('0'), findsNothing); expect(find.text('0'), findsNothing);
expect(dismissedItems, equals([0])); expect(dismissedItems, equals(<int>[0]));
}); });
testWidgets('drag-up with DismissDirection.up triggers dismiss', (WidgetTester tester) { testWidgets('drag-up with DismissDirection.up triggers dismiss', (WidgetTester tester) {
...@@ -213,7 +213,7 @@ void main() { ...@@ -213,7 +213,7 @@ void main() {
dismissItem(tester, 0, gestureDirection: DismissDirection.up); dismissItem(tester, 0, gestureDirection: DismissDirection.up);
expect(find.text('0'), findsNothing); expect(find.text('0'), findsNothing);
expect(dismissedItems, equals([0])); expect(dismissedItems, equals(<int>[0]));
}); });
testWidgets('drag-down with DismissDirection.down triggers dismiss', (WidgetTester tester) { testWidgets('drag-down with DismissDirection.down triggers dismiss', (WidgetTester tester) {
...@@ -229,7 +229,7 @@ void main() { ...@@ -229,7 +229,7 @@ void main() {
dismissItem(tester, 0, gestureDirection: DismissDirection.down); dismissItem(tester, 0, gestureDirection: DismissDirection.down);
expect(find.text('0'), findsNothing); expect(find.text('0'), findsNothing);
expect(dismissedItems, equals([0])); expect(dismissedItems, equals(<int>[0]));
}); });
// This is a regression test for an fn2 bug where dragging a card caused an // This is a regression test for an fn2 bug where dragging a card caused an
......
...@@ -68,21 +68,21 @@ void main() { ...@@ -68,21 +68,21 @@ void main() {
); );
tester.tap(find.text('0')); tester.tap(find.text('0'));
expect(log, equals([0])); expect(log, equals(<int>[0]));
tester.tap(find.text('1')); tester.tap(find.text('1'));
expect(log, equals([0, 1])); expect(log, equals(<int>[0, 1]));
tester.tap(find.text('2')); tester.tap(find.text('2'));
expect(log, equals([0, 1, 2])); expect(log, equals(<int>[0, 1, 2]));
log.clear(); log.clear();
tester.tapAt(new Point(20.0, 90.0)); tester.tapAt(new Point(20.0, 90.0));
expect(log, equals([1])); expect(log, equals(<int>[1]));
startOffset.value = 50.0; startOffset.value = 50.0;
tester.pump(); tester.pump();
log.clear(); log.clear();
tester.tapAt(new Point(20.0, 90.0)); tester.tapAt(new Point(20.0, 90.0));
expect(log, equals([0])); expect(log, equals(<int>[0]));
}); });
} }
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
new Focus( new Focus(
key: keyParentFocus, key: keyParentFocus,
child: new Row( child: new Row(
children: [ children: <Widget>[
new TestFocusable( new TestFocusable(
key: keyA, key: keyA,
no: 'a', no: 'a',
...@@ -148,7 +148,7 @@ void main() { ...@@ -148,7 +148,7 @@ void main() {
new Focus( new Focus(
key: keyParentFocus, key: keyParentFocus,
child: new Row( child: new Row(
children: [ children: <Widget>[
new TestFocusable( new TestFocusable(
key: keyA, key: keyA,
no: 'a', no: 'a',
...@@ -174,7 +174,7 @@ void main() { ...@@ -174,7 +174,7 @@ void main() {
new Focus( new Focus(
key: keyParentFocus, key: keyParentFocus,
child: new Row( child: new Row(
children: [ children: <Widget>[
new TestFocusable( new TestFocusable(
key: keyA, key: keyA,
no: 'a', no: 'a',
......
...@@ -44,17 +44,17 @@ void main() { ...@@ -44,17 +44,17 @@ void main() {
TestInherited first = new TestInherited(child: builder); TestInherited first = new TestInherited(child: builder);
tester.pumpWidget(first); tester.pumpWidget(first);
expect(log, equals([first])); expect(log, equals(<TestInherited>[first]));
TestInherited second = new TestInherited(child: builder, shouldNotify: false); TestInherited second = new TestInherited(child: builder, shouldNotify: false);
tester.pumpWidget(second); tester.pumpWidget(second);
expect(log, equals([first])); expect(log, equals(<TestInherited>[first]));
TestInherited third = new TestInherited(child: builder, shouldNotify: true); TestInherited third = new TestInherited(child: builder, shouldNotify: true);
tester.pumpWidget(third); tester.pumpWidget(third);
expect(log, equals([first, third])); expect(log, equals(<TestInherited>[first, third]));
}); });
testWidgets('Update inherited when reparenting state', (WidgetTester tester) { testWidgets('Update inherited when reparenting state', (WidgetTester tester) {
...@@ -79,12 +79,12 @@ void main() { ...@@ -79,12 +79,12 @@ void main() {
TestInherited first = build(); TestInherited first = build();
tester.pumpWidget(first); tester.pumpWidget(first);
expect(log, equals([first])); expect(log, equals(<TestInherited>[first]));
TestInherited second = build(); TestInherited second = build();
tester.pumpWidget(second); tester.pumpWidget(second);
expect(log, equals([first, second])); expect(log, equals(<TestInherited>[first, second]));
}); });
testWidgets('Update inherited when removing node', (WidgetTester tester) { testWidgets('Update inherited when removing node', (WidgetTester tester) {
......
...@@ -37,19 +37,19 @@ void main() { ...@@ -37,19 +37,19 @@ void main() {
FlipWidgetState testWidget = tester.state(find.byType(FlipWidget)); FlipWidgetState testWidget = tester.state(find.byType(FlipWidget));
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4, 5]));
callbackTracker.clear(); callbackTracker.clear();
testWidget.flip(); testWidget.flip();
tester.pump(); tester.pump();
expect(callbackTracker, equals([])); expect(callbackTracker, equals(<int>[]));
callbackTracker.clear(); callbackTracker.clear();
testWidget.flip(); testWidget.flip();
tester.pump(); tester.pump();
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4, 5]));
}); });
testWidgets('LazyBlockViewport vertical', (WidgetTester tester) { testWidgets('LazyBlockViewport vertical', (WidgetTester tester) {
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
tester.pumpWidget(builder()); tester.pumpWidget(builder());
// 0 is built to find its height // 0 is built to find its height
expect(callbackTracker, equals([0, 1, 2, 3, 4])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4]));
callbackTracker.clear(); callbackTracker.clear();
offset = 400.0; // now only 3 should fit, numbered 2-4. offset = 400.0; // now only 3 should fit, numbered 2-4.
...@@ -92,13 +92,13 @@ void main() { ...@@ -92,13 +92,13 @@ void main() {
tester.pumpWidget(builder()); tester.pumpWidget(builder());
// We build all the children to find their new size. // We build all the children to find their new size.
expect(callbackTracker, equals([0, 1, 2, 3, 4])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4]));
callbackTracker.clear(); callbackTracker.clear();
tester.pumpWidget(builder()); tester.pumpWidget(builder());
// 0 isn't built because they're not visible. // 0 isn't built because they're not visible.
expect(callbackTracker, equals([1, 2, 3, 4])); expect(callbackTracker, equals(<int>[1, 2, 3, 4]));
callbackTracker.clear(); callbackTracker.clear();
}); });
...@@ -135,7 +135,7 @@ void main() { ...@@ -135,7 +135,7 @@ void main() {
tester.pumpWidget(builder()); tester.pumpWidget(builder());
// 0 is built to find its width // 0 is built to find its width
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4, 5]));
callbackTracker.clear(); callbackTracker.clear();
...@@ -144,13 +144,13 @@ void main() { ...@@ -144,13 +144,13 @@ void main() {
tester.pumpWidget(builder()); tester.pumpWidget(builder());
// We build all the children to find their new size. // We build all the children to find their new size.
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4, 5]));
callbackTracker.clear(); callbackTracker.clear();
tester.pumpWidget(builder()); tester.pumpWidget(builder());
// 0 isn't built because they're not visible. // 0 isn't built because they're not visible.
expect(callbackTracker, equals([1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[1, 2, 3, 4, 5]));
callbackTracker.clear(); callbackTracker.clear();
}); });
...@@ -182,18 +182,18 @@ void main() { ...@@ -182,18 +182,18 @@ void main() {
tester.pumpWidget(builder()); tester.pumpWidget(builder());
expect(callbackTracker, equals([0, 1, 2])); expect(callbackTracker, equals(<int>[0, 1, 2]));
callbackTracker.clear(); callbackTracker.clear();
tester.allWidgets.forEach(collectText); tester.allWidgets.forEach(collectText);
expect(text, equals(['0', '1', '2'])); expect(text, equals(<String>['0', '1', '2']));
text.clear(); text.clear();
tester.pumpWidget(builder()); tester.pumpWidget(builder());
expect(callbackTracker, equals([0, 1, 2])); expect(callbackTracker, equals(<int>[0, 1, 2]));
callbackTracker.clear(); callbackTracker.clear();
tester.allWidgets.forEach(collectText); tester.allWidgets.forEach(collectText);
expect(text, equals(['0', '1', '2'])); expect(text, equals(<String>['0', '1', '2']));
text.clear(); text.clear();
}); });
......
...@@ -34,7 +34,7 @@ void main() { ...@@ -34,7 +34,7 @@ void main() {
tester.tap(find.text('X')); tester.tap(find.text('X'));
expect(log, equals([ expect(log, equals(<String>[
'bottom', 'bottom',
'middle', 'middle',
'top', 'top',
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
minHeight: 3.0, minHeight: 3.0,
maxHeight: 4.0 maxHeight: 4.0
).debugFillDescription(description); ).debugFillDescription(description);
expect(description, [ expect(description, <String>[
'alignment: FractionalOffset(0.5, 0.5)', 'alignment: FractionalOffset(0.5, 0.5)',
'minWidth: 1.0', 'minWidth: 1.0',
'maxWidth: 2.0', 'maxWidth: 2.0',
......
...@@ -66,8 +66,8 @@ void main() { ...@@ -66,8 +66,8 @@ void main() {
tester.pump(const Duration(seconds: 5)); // t=10 tester.pump(const Duration(seconds: 5)); // t=10
recordMetrics(); recordMetrics();
expect(sizes, equals([const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0)])); expect(sizes, equals(<Size>[const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0), const Size(10.0, 10.0)]));
expect(positions, equals([const Offset(10.0, 10.0), const Offset(10.0, 10.0), const Offset(17.0, 17.0), const Offset(24.0, 24.0), const Offset(45.0, 45.0), const Offset(80.0, 80.0)])); expect(positions, equals(<Offset>[const Offset(10.0, 10.0), const Offset(10.0, 10.0), const Offset(17.0, 17.0), const Offset(24.0, 24.0), const Offset(45.0, 45.0), const Offset(80.0, 80.0)]));
controller.stop(); controller.stop();
}); });
......
...@@ -316,13 +316,13 @@ void main() { ...@@ -316,13 +316,13 @@ void main() {
new Container(key: new UniqueKey(), child: logger) new Container(key: new UniqueKey(), child: logger)
); );
expect(log, equals(['build'])); expect(log, equals(<String>['build']));
tester.pumpWidget( tester.pumpWidget(
new Container(key: new UniqueKey(), child: logger) new Container(key: new UniqueKey(), child: logger)
); );
expect(log, equals(['build', 'deactivate', 'build'])); expect(log, equals(<String>['build', 'deactivate', 'build']));
log.clear(); log.clear();
tester.pump(); tester.pump();
......
...@@ -46,11 +46,11 @@ void main() { ...@@ -46,11 +46,11 @@ void main() {
expect(box.size.height, equals(175.0)); expect(box.size.height, equals(175.0));
tester.tapAt(new Point(420.0, 280.0)); tester.tapAt(new Point(420.0, 280.0));
expect(log, equals(['left'])); expect(log, equals(<String>['left']));
log.clear(); log.clear();
tester.tapAt(new Point(380.0, 320.0)); tester.tapAt(new Point(380.0, 320.0));
expect(log, equals(['right'])); expect(log, equals(<String>['right']));
log.clear(); log.clear();
}); });
} }
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
host, host,
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
}, },
[ <String>[
'initial: install', 'initial: install',
'initial: didPush', 'initial: didPush',
'initial: didChangeNext null', 'initial: didChangeNext null',
...@@ -115,7 +115,7 @@ void main() { ...@@ -115,7 +115,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(second = new TestRoute('second')); transaction.push(second = new TestRoute('second'));
}, },
[ <String>[
'second: install', 'second: install',
'second: didPush', 'second: didPush',
'second: didChangeNext null', 'second: didChangeNext null',
...@@ -128,7 +128,7 @@ void main() { ...@@ -128,7 +128,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(new TestRoute('third')); transaction.push(new TestRoute('third'));
}, },
[ <String>[
'third: install', 'third: install',
'third: didPush', 'third: didPush',
'third: didChangeNext null', 'third: didChangeNext null',
...@@ -141,7 +141,7 @@ void main() { ...@@ -141,7 +141,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.replace(oldRoute: second, newRoute: new TestRoute('two')); transaction.replace(oldRoute: second, newRoute: new TestRoute('two'));
}, },
[ <String>[
'two: install', 'two: install',
'two: didReplace second', 'two: didReplace second',
'two: didChangeNext third', 'two: didChangeNext third',
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.pop('hello'); transaction.pop('hello');
}, },
[ <String>[
'third: didPop hello', 'third: didPop hello',
'third: dispose', 'third: dispose',
'two: didPopNext third', 'two: didPopNext third',
...@@ -167,14 +167,14 @@ void main() { ...@@ -167,14 +167,14 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.pop('good bye'); transaction.pop('good bye');
}, },
[ <String>[
'two: didPop good bye', 'two: didPop good bye',
'two: dispose', 'two: dispose',
'initial: didPopNext two', 'initial: didPopNext two',
] ]
); );
tester.pumpWidget(new Container()); tester.pumpWidget(new Container());
expect(results, equals(['initial: dispose'])); expect(results, equals(<String>['initial: dispose']));
expect(routes.isEmpty, isTrue); expect(routes.isEmpty, isTrue);
results.clear(); results.clear();
}); });
...@@ -191,7 +191,7 @@ void main() { ...@@ -191,7 +191,7 @@ void main() {
host, host,
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
}, },
[ <String>[
'first: install', 'first: install',
'first: didPush', 'first: didPush',
'first: didChangeNext null', 'first: didChangeNext null',
...@@ -204,7 +204,7 @@ void main() { ...@@ -204,7 +204,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(second = new TestRoute('second')); transaction.push(second = new TestRoute('second'));
}, },
[ <String>[
'second: install', 'second: install',
'second: didPush', 'second: didPush',
'second: didChangeNext null', 'second: didChangeNext null',
...@@ -217,7 +217,7 @@ void main() { ...@@ -217,7 +217,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(new TestRoute('third')); transaction.push(new TestRoute('third'));
}, },
[ <String>[
'third: install', 'third: install',
'third: didPush', 'third: didPush',
'third: didChangeNext null', 'third: didChangeNext null',
...@@ -230,7 +230,7 @@ void main() { ...@@ -230,7 +230,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.removeRouteBefore(second); transaction.removeRouteBefore(second);
}, },
[ <String>[
'first: dispose', 'first: dispose',
] ]
); );
...@@ -240,7 +240,7 @@ void main() { ...@@ -240,7 +240,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.pop('good bye'); transaction.pop('good bye');
}, },
[ <String>[
'third: didPop good bye', 'third: didPop good bye',
'third: dispose', 'third: dispose',
'second: didPopNext third', 'second: didPopNext third',
...@@ -252,7 +252,7 @@ void main() { ...@@ -252,7 +252,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(new TestRoute('three')); transaction.push(new TestRoute('three'));
}, },
[ <String>[
'three: install', 'three: install',
'three: didPush', 'three: didPush',
'three: didChangeNext null', 'three: didChangeNext null',
...@@ -266,7 +266,7 @@ void main() { ...@@ -266,7 +266,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(four = new TestRoute('four')); transaction.push(four = new TestRoute('four'));
}, },
[ <String>[
'four: install', 'four: install',
'four: didPush', 'four: didPush',
'four: didChangeNext null', 'four: didChangeNext null',
...@@ -279,7 +279,7 @@ void main() { ...@@ -279,7 +279,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.removeRouteBefore(four); transaction.removeRouteBefore(four);
}, },
[ <String>[
'second: didChangeNext four', 'second: didChangeNext four',
'three: dispose', 'three: dispose',
] ]
...@@ -290,14 +290,14 @@ void main() { ...@@ -290,14 +290,14 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.pop('the end'); transaction.pop('the end');
}, },
[ <String>[
'four: didPop the end', 'four: didPop the end',
'four: dispose', 'four: dispose',
'second: didPopNext four', 'second: didPopNext four',
] ]
); );
tester.pumpWidget(new Container()); tester.pumpWidget(new Container());
expect(results, equals(['second: dispose'])); expect(results, equals(<String>['second: dispose']));
expect(routes.isEmpty, isTrue); expect(routes.isEmpty, isTrue);
results.clear(); results.clear();
}); });
...@@ -314,7 +314,7 @@ void main() { ...@@ -314,7 +314,7 @@ void main() {
host, host,
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
}, },
[ <String>[
'A: install', 'A: install',
'A: didPush', 'A: didPush',
'A: didChangeNext null', 'A: didChangeNext null',
...@@ -326,7 +326,7 @@ void main() { ...@@ -326,7 +326,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(new TestRoute('B')); transaction.push(new TestRoute('B'));
}, },
[ <String>[
'B: install', 'B: install',
'B: didPush', 'B: didPush',
'B: didChangeNext null', 'B: didChangeNext null',
...@@ -340,7 +340,7 @@ void main() { ...@@ -340,7 +340,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.push(routeC = new TestRoute('C')); transaction.push(routeC = new TestRoute('C'));
}, },
[ <String>[
'C: install', 'C: install',
'C: didPush', 'C: didPush',
'C: didChangeNext null', 'C: didChangeNext null',
...@@ -354,7 +354,7 @@ void main() { ...@@ -354,7 +354,7 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.replaceRouteBefore(anchorRoute: routeC, newRoute: routeB = new TestRoute('b')); transaction.replaceRouteBefore(anchorRoute: routeC, newRoute: routeB = new TestRoute('b'));
}, },
[ <String>[
'b: install', 'b: install',
'b: didReplace B', 'b: didReplace B',
'b: didChangeNext C', 'b: didChangeNext C',
...@@ -368,14 +368,14 @@ void main() { ...@@ -368,14 +368,14 @@ void main() {
(NavigatorTransaction transaction) { (NavigatorTransaction transaction) {
transaction.popUntil(routeB); transaction.popUntil(routeB);
}, },
[ <String>[
'C: didPop null', 'C: didPop null',
'C: dispose', 'C: dispose',
'b: didPopNext C', 'b: didPopNext C',
] ]
); );
tester.pumpWidget(new Container()); tester.pumpWidget(new Container());
expect(results, equals(['A: dispose', 'b: dispose'])); expect(results, equals(<String>['A: dispose', 'b: dispose']));
expect(routes.isEmpty, isTrue); expect(routes.isEmpty, isTrue);
results.clear(); results.clear();
}); });
......
...@@ -27,19 +27,19 @@ void main() { ...@@ -27,19 +27,19 @@ void main() {
List<String> log = <String>[]; List<String> log = <String>[];
tester.pumpWidget(_buildScroller(log: log)); tester.pumpWidget(_buildScroller(log: log));
expect(log, equals([])); expect(log, equals(<String>[]));
TestGesture gesture = tester.startGesture(new Point(100.0, 100.0)); TestGesture gesture = tester.startGesture(new Point(100.0, 100.0));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.pump(const Duration(seconds: 1)); tester.pump(const Duration(seconds: 1));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
gesture.moveBy(new Offset(-10.0, -10.0)); gesture.moveBy(new Offset(-10.0, -10.0));
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
tester.pump(const Duration(seconds: 1)); tester.pump(const Duration(seconds: 1));
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
gesture.up(); gesture.up();
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
tester.pump(const Duration(seconds: 1)); tester.pump(const Duration(seconds: 1));
expect(log, equals(['scrollstart', 'scroll', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scroll', 'scrollend']));
}); });
testWidgets('Scroll scrollTo animation', (WidgetTester tester) { testWidgets('Scroll scrollTo animation', (WidgetTester tester) {
...@@ -47,15 +47,15 @@ void main() { ...@@ -47,15 +47,15 @@ void main() {
List<String> log = <String>[]; List<String> log = <String>[];
tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals([])); expect(log, equals(<String>[]));
scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1)); scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
tester.pump(const Duration(milliseconds: 1500)); tester.pump(const Duration(milliseconds: 1500));
expect(log, equals(['scrollstart', 'scroll', 'scroll', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scroll', 'scroll', 'scrollend']));
}); });
testWidgets('Scroll scrollTo no animation', (WidgetTester tester) { testWidgets('Scroll scrollTo no animation', (WidgetTester tester) {
...@@ -63,9 +63,9 @@ void main() { ...@@ -63,9 +63,9 @@ void main() {
List<String> log = <String>[]; List<String> log = <String>[];
tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals([])); expect(log, equals(<String>[]));
scrollKey.currentState.scrollTo(100.0); scrollKey.currentState.scrollTo(100.0);
expect(log, equals(['scrollstart', 'scroll', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scroll', 'scrollend']));
}); });
testWidgets('Scroll during animation', (WidgetTester tester) { testWidgets('Scroll during animation', (WidgetTester tester) {
...@@ -73,19 +73,19 @@ void main() { ...@@ -73,19 +73,19 @@ void main() {
List<String> log = <String>[]; List<String> log = <String>[];
tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals([])); expect(log, equals(<String>[]));
scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1)); scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
scrollKey.currentState.scrollTo(100.0); scrollKey.currentState.scrollTo(100.0);
expect(log, equals(['scrollstart', 'scroll', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll', 'scroll']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart', 'scroll', 'scroll', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scroll', 'scroll', 'scrollend']));
tester.pump(const Duration(milliseconds: 1500)); tester.pump(const Duration(milliseconds: 1500));
expect(log, equals(['scrollstart', 'scroll', 'scroll', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scroll', 'scroll', 'scrollend']));
}); });
testWidgets('Scroll during animation', (WidgetTester tester) { testWidgets('Scroll during animation', (WidgetTester tester) {
...@@ -93,19 +93,19 @@ void main() { ...@@ -93,19 +93,19 @@ void main() {
List<String> log = <String>[]; List<String> log = <String>[];
tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals([])); expect(log, equals(<String>[]));
scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1)); scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1)); scrollKey.currentState.scrollTo(100.0, duration: const Duration(seconds: 1));
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
tester.pump(const Duration(milliseconds: 100)); tester.pump(const Duration(milliseconds: 100));
expect(log, equals(['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
tester.pump(const Duration(milliseconds: 1500)); tester.pump(const Duration(milliseconds: 1500));
expect(log, equals(['scrollstart', 'scroll', 'scroll', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scroll', 'scroll', 'scrollend']));
}); });
testWidgets('fling, fling generates two start/end pairs', (WidgetTester tester) { testWidgets('fling, fling generates two start/end pairs', (WidgetTester tester) {
...@@ -113,18 +113,18 @@ void main() { ...@@ -113,18 +113,18 @@ void main() {
List<String> log = <String>[]; List<String> log = <String>[];
tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals([])); expect(log, equals(<String>[]));
tester.flingFrom(new Point(100.0, 100.0), new Offset(-50.0, -50.0), 500.0); tester.flingFrom(new Point(100.0, 100.0), new Offset(-50.0, -50.0), 500.0);
tester.pump(new Duration(seconds: 1)); tester.pump(new Duration(seconds: 1));
log.removeWhere((String value) => value == 'scroll'); log.removeWhere((String value) => value == 'scroll');
expect(log, equals(['scrollstart'])); expect(log, equals(<String>['scrollstart']));
tester.flingFrom(new Point(100.0, 100.0), new Offset(-50.0, -50.0), 500.0); tester.flingFrom(new Point(100.0, 100.0), new Offset(-50.0, -50.0), 500.0);
log.removeWhere((String value) => value == 'scroll'); log.removeWhere((String value) => value == 'scroll');
expect(log, equals(['scrollstart', 'scrollend', 'scrollstart'])); expect(log, equals(<String>['scrollstart', 'scrollend', 'scrollstart']));
tester.pump(new Duration(seconds: 1)); tester.pump(new Duration(seconds: 1));
tester.pump(new Duration(seconds: 1)); tester.pump(new Duration(seconds: 1));
log.removeWhere((String value) => value == 'scroll'); log.removeWhere((String value) => value == 'scroll');
expect(log, equals(['scrollstart', 'scrollend', 'scrollstart', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scrollend', 'scrollstart', 'scrollend']));
}); });
testWidgets('fling up ends', (WidgetTester tester) { testWidgets('fling up ends', (WidgetTester tester) {
...@@ -132,7 +132,7 @@ void main() { ...@@ -132,7 +132,7 @@ void main() {
List<String> log = <String>[]; List<String> log = <String>[];
tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals([])); expect(log, equals(<String>[]));
tester.flingFrom(new Point(100.0, 100.0), new Offset(50.0, 50.0), 500.0); tester.flingFrom(new Point(100.0, 100.0), new Offset(50.0, 50.0), 500.0);
tester.pump(new Duration(seconds: 1)); tester.pump(new Duration(seconds: 1));
tester.pump(new Duration(seconds: 1)); tester.pump(new Duration(seconds: 1));
......
...@@ -40,19 +40,19 @@ void main() { ...@@ -40,19 +40,19 @@ void main() {
FlipWidgetState testWidget = tester.state(find.byType(FlipWidget)); FlipWidgetState testWidget = tester.state(find.byType(FlipWidget));
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4, 5]));
callbackTracker.clear(); callbackTracker.clear();
testWidget.flip(); testWidget.flip();
tester.pump(); tester.pump();
expect(callbackTracker, equals([])); expect(callbackTracker, equals(<int>[]));
callbackTracker.clear(); callbackTracker.clear();
testWidget.flip(); testWidget.flip();
tester.pump(); tester.pump();
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[0, 1, 2, 3, 4, 5]));
}); });
testWidgets('HomogeneousViewport vertical', (WidgetTester tester) { testWidgets('HomogeneousViewport vertical', (WidgetTester tester) {
...@@ -89,7 +89,7 @@ void main() { ...@@ -89,7 +89,7 @@ void main() {
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([1, 2, 3, 4])); expect(callbackTracker, equals(<int>[1, 2, 3, 4]));
callbackTracker.clear(); callbackTracker.clear();
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([2, 3, 4])); expect(callbackTracker, equals(<int>[2, 3, 4]));
callbackTracker.clear(); callbackTracker.clear();
}); });
...@@ -138,7 +138,7 @@ void main() { ...@@ -138,7 +138,7 @@ void main() {
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([1, 2, 3, 4, 5])); expect(callbackTracker, equals(<int>[1, 2, 3, 4, 5]));
callbackTracker.clear(); callbackTracker.clear();
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([2, 3, 4, 5])); expect(callbackTracker, equals(<int>[2, 3, 4, 5]));
callbackTracker.clear(); callbackTracker.clear();
}); });
...@@ -177,22 +177,22 @@ void main() { ...@@ -177,22 +177,22 @@ void main() {
); );
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([0, 1])); expect(callbackTracker, equals(<int>[0, 1]));
callbackTracker.clear(); callbackTracker.clear();
scrollableKey.currentState.scrollTo(150.0); scrollableKey.currentState.scrollTo(150.0);
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([0, 1, 2])); expect(callbackTracker, equals(<int>[0, 1, 2]));
callbackTracker.clear(); callbackTracker.clear();
scrollableKey.currentState.scrollTo(600.0); scrollableKey.currentState.scrollTo(600.0);
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([2, 3])); expect(callbackTracker, equals(<int>[2, 3]));
callbackTracker.clear(); callbackTracker.clear();
scrollableKey.currentState.scrollTo(750.0); scrollableKey.currentState.scrollTo(750.0);
tester.pumpWidget(testWidget); tester.pumpWidget(testWidget);
expect(callbackTracker, equals([2, 3, 4])); expect(callbackTracker, equals(<int>[2, 3, 4]));
callbackTracker.clear(); callbackTracker.clear();
}); });
......
...@@ -43,9 +43,9 @@ void main() { ...@@ -43,9 +43,9 @@ void main() {
expect(find.text('3'), findsOneWidget); expect(find.text('3'), findsOneWidget);
expect(find.text('4'), findsNothing); expect(find.text('4'), findsNothing);
expect(find.text('5'), findsNothing); expect(find.text('5'), findsNothing);
expect(tapped, equals([])); expect(tapped, equals(<int>[]));
tester.tap(find.text('2')); tester.tap(find.text('2'));
expect(tapped, equals([2])); expect(tapped, equals(<int>[2]));
}); });
testWidgets('Tap item after scroll - vertical', (WidgetTester tester) { testWidgets('Tap item after scroll - vertical', (WidgetTester tester) {
...@@ -81,11 +81,11 @@ void main() { ...@@ -81,11 +81,11 @@ void main() {
expect(find.text('3'), findsOneWidget); expect(find.text('3'), findsOneWidget);
expect(find.text('4'), findsNothing); expect(find.text('4'), findsNothing);
expect(find.text('5'), findsNothing); expect(find.text('5'), findsNothing);
expect(tapped, equals([])); expect(tapped, equals(<int>[]));
tester.tap(find.text('1')); tester.tap(find.text('1'));
expect(tapped, equals([1])); expect(tapped, equals(<int>[1]));
tester.tap(find.text('3')); tester.tap(find.text('3'));
expect(tapped, equals([1])); // the center of the third item is off-screen so it shouldn't get hit expect(tapped, equals(<int>[1])); // the center of the third item is off-screen so it shouldn't get hit
}); });
testWidgets('Padding scroll anchor start', (WidgetTester tester) { testWidgets('Padding scroll anchor start', (WidgetTester tester) {
...@@ -107,17 +107,17 @@ void main() { ...@@ -107,17 +107,17 @@ void main() {
) )
); );
tester.tapAt(new Point(200.0, 19.0)); tester.tapAt(new Point(200.0, 19.0));
expect(tapped, equals([])); expect(tapped, equals(<int>[]));
tester.tapAt(new Point(200.0, 21.0)); tester.tapAt(new Point(200.0, 21.0));
expect(tapped, equals([0])); expect(tapped, equals(<int>[0]));
tester.tapAt(new Point(4.0, 400.0)); tester.tapAt(new Point(4.0, 400.0));
expect(tapped, equals([0])); expect(tapped, equals(<int>[0]));
tester.tapAt(new Point(6.0, 400.0)); tester.tapAt(new Point(6.0, 400.0));
expect(tapped, equals([0, 1])); expect(tapped, equals(<int>[0, 1]));
tester.tapAt(new Point(800.0 - 14.0, 400.0)); tester.tapAt(new Point(800.0 - 14.0, 400.0));
expect(tapped, equals([0, 1])); expect(tapped, equals(<int>[0, 1]));
tester.tapAt(new Point(800.0 - 16.0, 400.0)); tester.tapAt(new Point(800.0 - 16.0, 400.0));
expect(tapped, equals([0, 1, 1])); expect(tapped, equals(<int>[0, 1, 1]));
}); });
testWidgets('Padding scroll anchor end', (WidgetTester tester) { testWidgets('Padding scroll anchor end', (WidgetTester tester) {
...@@ -140,16 +140,16 @@ void main() { ...@@ -140,16 +140,16 @@ void main() {
) )
); );
tester.tapAt(new Point(200.0, 600.0 - 9.0)); tester.tapAt(new Point(200.0, 600.0 - 9.0));
expect(tapped, equals([])); expect(tapped, equals(<int>[]));
tester.tapAt(new Point(200.0, 600.0 - 11.0)); tester.tapAt(new Point(200.0, 600.0 - 11.0));
expect(tapped, equals([5])); expect(tapped, equals(<int>[5]));
tester.tapAt(new Point(4.0, 200.0)); tester.tapAt(new Point(4.0, 200.0));
expect(tapped, equals([5])); expect(tapped, equals(<int>[5]));
tester.tapAt(new Point(6.0, 200.0)); tester.tapAt(new Point(6.0, 200.0));
expect(tapped, equals([5, 4])); expect(tapped, equals(<int>[5, 4]));
tester.tapAt(new Point(800.0 - 14.0, 200.0)); tester.tapAt(new Point(800.0 - 14.0, 200.0));
expect(tapped, equals([5, 4])); expect(tapped, equals(<int>[5, 4]));
tester.tapAt(new Point(800.0 - 16.0, 200.0)); tester.tapAt(new Point(800.0 - 16.0, 200.0));
expect(tapped, equals([5, 4, 4])); expect(tapped, equals(<int>[5, 4, 4]));
}); });
} }
...@@ -134,7 +134,7 @@ void main() { ...@@ -134,7 +134,7 @@ void main() {
expect(client.updates[0].children[1].flags.hasCheckedState, isFalse); expect(client.updates[0].children[1].flags.hasCheckedState, isFalse);
expect(client.updates[0].children[1].flags.isChecked, isFalse); expect(client.updates[0].children[1].flags.isChecked, isFalse);
expect(client.updates[0].children[1].strings.label, equals('child2')); expect(client.updates[0].children[1].strings.label, equals('child2'));
expect(client.updates[0].children[1].geometry.transform, equals([1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0])); expect(client.updates[0].children[1].geometry.transform, equals(<double>[1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0]));
expect(client.updates[0].children[1].geometry.left, equals(0.0)); expect(client.updates[0].children[1].geometry.left, equals(0.0));
expect(client.updates[0].children[1].geometry.top, equals(0.0)); expect(client.updates[0].children[1].geometry.top, equals(0.0));
expect(client.updates[0].children[1].geometry.width, equals(800.0)); expect(client.updates[0].children[1].geometry.width, equals(800.0));
...@@ -236,7 +236,7 @@ void main() { ...@@ -236,7 +236,7 @@ void main() {
expect(client.updates[0].children[1].flags.hasCheckedState, isFalse); expect(client.updates[0].children[1].flags.hasCheckedState, isFalse);
expect(client.updates[0].children[1].flags.isChecked, isFalse); expect(client.updates[0].children[1].flags.isChecked, isFalse);
expect(client.updates[0].children[1].strings.label, equals('child2')); expect(client.updates[0].children[1].strings.label, equals('child2'));
expect(client.updates[0].children[1].geometry.transform, equals([1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0])); expect(client.updates[0].children[1].geometry.transform, equals(<double>[1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0]));
expect(client.updates[0].children[1].geometry.left, equals(0.0)); expect(client.updates[0].children[1].geometry.left, equals(0.0));
expect(client.updates[0].children[1].geometry.top, equals(0.0)); expect(client.updates[0].children[1].geometry.top, equals(0.0));
expect(client.updates[0].children[1].geometry.width, equals(800.0)); expect(client.updates[0].children[1].geometry.width, equals(800.0));
......
...@@ -74,7 +74,7 @@ void main() { ...@@ -74,7 +74,7 @@ void main() {
expect(client.updates[0].children[1].flags.hasCheckedState, isFalse); expect(client.updates[0].children[1].flags.hasCheckedState, isFalse);
expect(client.updates[0].children[1].flags.isChecked, isFalse); expect(client.updates[0].children[1].flags.isChecked, isFalse);
expect(client.updates[0].children[1].strings.label, equals('child2')); expect(client.updates[0].children[1].strings.label, equals('child2'));
expect(client.updates[0].children[1].geometry.transform, equals([1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0])); expect(client.updates[0].children[1].geometry.transform, equals(<double>[1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0]));
expect(client.updates[0].children[1].geometry.left, equals(0.0)); expect(client.updates[0].children[1].geometry.left, equals(0.0));
expect(client.updates[0].children[1].geometry.top, equals(0.0)); expect(client.updates[0].children[1].geometry.top, equals(0.0));
expect(client.updates[0].children[1].geometry.width, equals(800.0)); expect(client.updates[0].children[1].geometry.width, equals(800.0));
...@@ -176,7 +176,7 @@ void main() { ...@@ -176,7 +176,7 @@ void main() {
expect(client.updates[0].children[1].flags.hasCheckedState, isFalse); expect(client.updates[0].children[1].flags.hasCheckedState, isFalse);
expect(client.updates[0].children[1].flags.isChecked, isFalse); expect(client.updates[0].children[1].flags.isChecked, isFalse);
expect(client.updates[0].children[1].strings.label, equals('child2')); expect(client.updates[0].children[1].strings.label, equals('child2'));
expect(client.updates[0].children[1].geometry.transform, equals([1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0])); expect(client.updates[0].children[1].geometry.transform, equals(<double>[1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,10.0,0.0,1.0]));
expect(client.updates[0].children[1].geometry.left, equals(0.0)); expect(client.updates[0].children[1].geometry.left, equals(0.0));
expect(client.updates[0].children[1].geometry.top, equals(0.0)); expect(client.updates[0].children[1].geometry.top, equals(0.0));
expect(client.updates[0].children[1].geometry.width, equals(800.0)); expect(client.updates[0].children[1].geometry.width, equals(800.0));
......
...@@ -155,13 +155,13 @@ void main() { ...@@ -155,13 +155,13 @@ void main() {
expect(find.text('0'), findsOneWidget); expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsOneWidget); expect(find.text('1'), findsOneWidget);
expect(find.text('2'), findsOneWidget); expect(find.text('2'), findsOneWidget);
expect(itemsPainted, equals([0])); expect(itemsPainted, equals(<int>[0]));
tester.pumpWidget(buildFrame(1)); tester.pumpWidget(buildFrame(1));
expect(itemsPainted, equals([1])); expect(itemsPainted, equals(<int>[1]));
tester.pumpWidget(buildFrame(2)); tester.pumpWidget(buildFrame(2));
expect(itemsPainted, equals([2])); expect(itemsPainted, equals(<int>[2]));
}); });
testWidgets('Can hit test an IndexedStack', (WidgetTester tester) { testWidgets('Can hit test an IndexedStack', (WidgetTester tester) {
...@@ -180,12 +180,12 @@ void main() { ...@@ -180,12 +180,12 @@ void main() {
tester.pumpWidget(buildFrame(0)); tester.pumpWidget(buildFrame(0));
expect(itemsTapped, isEmpty); expect(itemsTapped, isEmpty);
tester.tap(find.byKey(key)); tester.tap(find.byKey(key));
expect(itemsTapped, [0]); expect(itemsTapped, <int>[0]);
tester.pumpWidget(buildFrame(2)); tester.pumpWidget(buildFrame(2));
expect(itemsTapped, isEmpty); expect(itemsTapped, isEmpty);
tester.tap(find.byKey(key)); tester.tap(find.byKey(key));
expect(itemsTapped, [2]); expect(itemsTapped, <int>[2]);
}); });
testWidgets('Can set width and height', (WidgetTester tester) { testWidgets('Can set width and height', (WidgetTester tester) {
......
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