Commit 8bc06aa9 authored by pq's avatar pq

More type annotations for literals.

The `flutter` package gets more types!

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