commit
292d5aab51
@ -27,7 +27,8 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
RenderBox stack = new RenderStack(children: <RenderBox>[red, green]);
|
RenderBox stack = new RenderStack(children: <RenderBox>[red, green]);
|
||||||
(green.parentData as StackParentData)
|
StackParentData greenParentData = green.parentData;
|
||||||
|
greenParentData
|
||||||
..top = 0.0
|
..top = 0.0
|
||||||
..right = 0.0
|
..right = 0.0
|
||||||
..bottom = 0.0
|
..bottom = 0.0
|
||||||
|
@ -69,7 +69,7 @@ class TestAssetBundle extends AssetBundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<ui.Image> testDecodeImageFromDataPipe(core.MojoDataPipeConsumer pipe) {
|
Future<ui.Image> testDecodeImageFromDataPipe(core.MojoDataPipeConsumer pipe) {
|
||||||
TestMojoDataPipeConsumer testPipe = pipe as TestMojoDataPipeConsumer;
|
TestMojoDataPipeConsumer testPipe = pipe;
|
||||||
assert(testPipe != null);
|
assert(testPipe != null);
|
||||||
ui.Image image = new TestImage(testPipe.scale);
|
ui.Image image = new TestImage(testPipe.scale);
|
||||||
return (new Completer<ui.Image>()..complete(image)).future;
|
return (new Completer<ui.Image>()..complete(image)).future;
|
||||||
@ -108,11 +108,11 @@ Widget buildImageAtRatio(String image, Key key, double ratio, bool inferSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderImage getRenderImage(tester, Key key) {
|
RenderImage getRenderImage(tester, Key key) {
|
||||||
return tester.findElementByKey(key).renderObject as RenderImage;
|
return tester.findElementByKey(key).renderObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestImage getTestImage(tester, Key key) {
|
TestImage getTestImage(tester, Key key) {
|
||||||
return getRenderImage(tester, key).image as TestImage;
|
return getRenderImage(tester, key).image;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pumpTreeToLayout(WidgetTester tester, Widget widget) {
|
void pumpTreeToLayout(WidgetTester tester, Widget widget) {
|
||||||
|
@ -104,10 +104,12 @@ void main() {
|
|||||||
right: new ProbeWidget()
|
right: new ProbeWidget()
|
||||||
));
|
));
|
||||||
expect(ProbeWidgetState.buildCount, equals(2));
|
expect(ProbeWidgetState.buildCount, equals(2));
|
||||||
(flipKey.currentState as FlipComponentState).flip();
|
FlipComponentState flipState1 = flipKey.currentState;
|
||||||
|
flipState1.flip();
|
||||||
tester.pump();
|
tester.pump();
|
||||||
expect(ProbeWidgetState.buildCount, equals(3));
|
expect(ProbeWidgetState.buildCount, equals(3));
|
||||||
(flipKey.currentState as FlipComponentState).flip();
|
FlipComponentState flipState2 = flipKey.currentState;
|
||||||
|
flipState2.flip();
|
||||||
tester.pump();
|
tester.pump();
|
||||||
expect(ProbeWidgetState.buildCount, equals(3));
|
expect(ProbeWidgetState.buildCount, equals(3));
|
||||||
tester.pumpWidget(new Container());
|
tester.pumpWidget(new Container());
|
||||||
|
@ -38,14 +38,12 @@ void main() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
expect((tester.findElementByKey(keyA).renderObject as RenderBox).localToGlobal(const Point(0.0, 0.0)),
|
RenderBox boxA = tester.findElementByKey(keyA).renderObject;
|
||||||
equals(const Point(100.0, 100.0)));
|
expect(boxA.localToGlobal(const Point(0.0, 0.0)), equals(const Point(100.0, 100.0)));
|
||||||
|
|
||||||
expect((tester.findElementByKey(keyB).renderObject as RenderBox).localToGlobal(const Point(0.0, 0.0)),
|
RenderBox boxB = tester.findElementByKey(keyB).renderObject;
|
||||||
equals(const Point(100.0, 200.0)));
|
expect(boxB.localToGlobal(const Point(0.0, 0.0)), equals(const Point(100.0, 200.0)));
|
||||||
|
expect(boxB.globalToLocal(const Point(110.0, 205.0)), equals(const Point(10.0, 5.0)));
|
||||||
expect((tester.findElementByKey(keyB).renderObject as RenderBox).globalToLocal(const Point(110.0, 205.0)),
|
|
||||||
equals(const Point(10.0, 5.0)));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,8 @@ void main() {
|
|||||||
tester.pumpWidget(builder());
|
tester.pumpWidget(builder());
|
||||||
|
|
||||||
Element input = tester.findElementByKey(inputKey);
|
Element input = tester.findElementByKey(inputKey);
|
||||||
Size emptyInputSize = (input.renderObject as RenderBox).size;
|
RenderBox inputBox = input.renderObject;
|
||||||
|
Size emptyInputSize = inputBox.size;
|
||||||
|
|
||||||
void enterText(String testValue) {
|
void enterText(String testValue) {
|
||||||
// Simulate entry of text through the keyboard.
|
// Simulate entry of text through the keyboard.
|
||||||
@ -65,10 +66,12 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enterText(' ');
|
enterText(' ');
|
||||||
expect((input.renderObject as RenderBox).size, equals(emptyInputSize));
|
expect(input.renderObject, equals(inputBox));
|
||||||
|
expect(inputBox.size, equals(emptyInputSize));
|
||||||
|
|
||||||
enterText('Test');
|
enterText('Test');
|
||||||
expect((input.renderObject as RenderBox).size, equals(emptyInputSize));
|
expect(input.renderObject, equals(inputBox));
|
||||||
|
expect(inputBox.size, equals(emptyInputSize));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
|
|||||||
expect(parentData.right, equals(expected.right));
|
expect(parentData.right, equals(expected.right));
|
||||||
expect(parentData.bottom, equals(expected.bottom));
|
expect(parentData.bottom, equals(expected.bottom));
|
||||||
expect(parentData.left, equals(expected.left));
|
expect(parentData.left, equals(expected.left));
|
||||||
child = (decoratedBox.parentData as StackParentData).nextSibling;
|
StackParentData decoratedBoxParentData = decoratedBox.parentData;
|
||||||
|
child = decoratedBoxParentData.nextSibling;
|
||||||
}
|
}
|
||||||
expect(child, isNull);
|
expect(child, isNull);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -47,8 +47,10 @@ void main() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
(left.currentState as StateMarkerState).marker = "left";
|
StateMarkerState leftState = left.currentState;
|
||||||
(right.currentState as StateMarkerState).marker = "right";
|
leftState.marker = "left";
|
||||||
|
StateMarkerState rightState = right.currentState;
|
||||||
|
rightState.marker = "right";
|
||||||
|
|
||||||
StateMarkerState grandchildState = tester.findStateByConfig(grandchild);
|
StateMarkerState grandchildState = tester.findStateByConfig(grandchild);
|
||||||
expect(grandchildState, isNotNull);
|
expect(grandchildState, isNotNull);
|
||||||
@ -71,8 +73,10 @@ void main() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
expect((left.currentState as StateMarkerState).marker, equals("left"));
|
expect(left.currentState, equals(leftState));
|
||||||
expect((right.currentState as StateMarkerState).marker, equals("right"));
|
expect(leftState.marker, equals("left"));
|
||||||
|
expect(right.currentState, equals(rightState));
|
||||||
|
expect(rightState.marker, equals("right"));
|
||||||
|
|
||||||
StateMarkerState newGrandchildState = tester.findStateByConfig(newGrandchild);
|
StateMarkerState newGrandchildState = tester.findStateByConfig(newGrandchild);
|
||||||
expect(newGrandchildState, isNotNull);
|
expect(newGrandchildState, isNotNull);
|
||||||
@ -90,7 +94,8 @@ void main() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
expect((left.currentState as StateMarkerState).marker, equals("left"));
|
expect(left.currentState, equals(leftState));
|
||||||
|
expect(leftState.marker, equals("left"));
|
||||||
expect(right.currentState, isNull);
|
expect(right.currentState, isNull);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -113,8 +118,10 @@ void main() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
(left.currentState as StateMarkerState).marker = "left";
|
StateMarkerState leftState = left.currentState;
|
||||||
(right.currentState as StateMarkerState).marker = "right";
|
leftState.marker = "left";
|
||||||
|
StateMarkerState rightState = right.currentState;
|
||||||
|
rightState.marker = "right";
|
||||||
|
|
||||||
StateMarkerState grandchildState = tester.findStateByConfig(grandchild);
|
StateMarkerState grandchildState = tester.findStateByConfig(grandchild);
|
||||||
expect(grandchildState, isNotNull);
|
expect(grandchildState, isNotNull);
|
||||||
@ -133,8 +140,10 @@ void main() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
expect((left.currentState as StateMarkerState).marker, equals("left"));
|
expect(left.currentState, equals(leftState));
|
||||||
expect((right.currentState as StateMarkerState).marker, equals("right"));
|
expect(leftState.marker, equals("left"));
|
||||||
|
expect(right.currentState, equals(rightState));
|
||||||
|
expect(rightState.marker, equals("right"));
|
||||||
|
|
||||||
StateMarkerState newGrandchildState = tester.findStateByConfig(newGrandchild);
|
StateMarkerState newGrandchildState = tester.findStateByConfig(newGrandchild);
|
||||||
expect(newGrandchildState, isNotNull);
|
expect(newGrandchildState, isNotNull);
|
||||||
@ -152,7 +161,8 @@ void main() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
expect((left.currentState as StateMarkerState).marker, equals("left"));
|
expect(left.currentState, equals(leftState));
|
||||||
|
expect(leftState.marker, equals("left"));
|
||||||
expect(right.currentState, isNull);
|
expect(right.currentState, isNull);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -163,7 +173,8 @@ void main() {
|
|||||||
|
|
||||||
tester.pumpWidget(new StateMarker(key: key));
|
tester.pumpWidget(new StateMarker(key: key));
|
||||||
|
|
||||||
(key.currentState as StateMarkerState).marker = "marked";
|
StateMarkerState keyState = key.currentState;
|
||||||
|
keyState.marker = "marked";
|
||||||
|
|
||||||
tester.pumpWidget(new ScrollableList(
|
tester.pumpWidget(new ScrollableList(
|
||||||
itemExtent: 100.0,
|
itemExtent: 100.0,
|
||||||
@ -176,11 +187,13 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
expect((key.currentState as StateMarkerState).marker, equals("marked"));
|
expect(key.currentState, equals(keyState));
|
||||||
|
expect(keyState.marker, equals("marked"));
|
||||||
|
|
||||||
tester.pumpWidget(new StateMarker(key: key));
|
tester.pumpWidget(new StateMarker(key: key));
|
||||||
|
|
||||||
expect((key.currentState as StateMarkerState).marker, equals("marked"));
|
expect(key.currentState, equals(keyState));
|
||||||
|
expect(keyState.marker, equals("marked"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -138,14 +138,14 @@ class Instrumentation {
|
|||||||
/// the element's render object has been laid out at least once.
|
/// the element's render object has been laid out at least once.
|
||||||
Size getSize(Element element) {
|
Size getSize(Element element) {
|
||||||
assert(element != null);
|
assert(element != null);
|
||||||
RenderBox box = element.renderObject as RenderBox;
|
RenderBox box = element.renderObject;
|
||||||
assert(box != null);
|
assert(box != null);
|
||||||
return box.size;
|
return box.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point _getElementPoint(Element element, SizeToPointFunction sizeToPoint) {
|
Point _getElementPoint(Element element, SizeToPointFunction sizeToPoint) {
|
||||||
assert(element != null);
|
assert(element != null);
|
||||||
RenderBox box = element.renderObject as RenderBox;
|
RenderBox box = element.renderObject;
|
||||||
assert(box != null);
|
assert(box != null);
|
||||||
return box.localToGlobal(sizeToPoint(box.size));
|
return box.localToGlobal(sizeToPoint(box.size));
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class AndroidApk extends ApplicationPackage {
|
|||||||
String launchActivity;
|
String launchActivity;
|
||||||
for (xml.XmlElement category in document.findAllElements('category')) {
|
for (xml.XmlElement category in document.findAllElements('category')) {
|
||||||
if (category.getAttribute('android:name') == 'android.intent.category.LAUNCHER') {
|
if (category.getAttribute('android:name') == 'android.intent.category.LAUNCHER') {
|
||||||
xml.XmlElement activity = category.parent.parent as xml.XmlElement;
|
xml.XmlElement activity = category.parent.parent;
|
||||||
String activityName = activity.getAttribute('android:name');
|
String activityName = activity.getAttribute('android:name');
|
||||||
launchActivity = "$id/$activityName";
|
launchActivity = "$id/$activityName";
|
||||||
break;
|
break;
|
||||||
|
@ -294,9 +294,10 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
for (String package in packages.keys)
|
for (String package in packages.keys)
|
||||||
packagesBody.writeln('$package:${path.toUri(packages[package])}');
|
packagesBody.writeln('$package:${path.toUri(packages[package])}');
|
||||||
|
|
||||||
/// specify analysis options
|
/// Specify analysis options.
|
||||||
/// note that until there is a default "all-in" lint rule-set we need
|
/// Note that until there is a default "all-in" lint rule-set we need
|
||||||
/// to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843)
|
/// to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843).
|
||||||
|
/// For a list of lints, see: http://dart-lang.github.io/linter/lints/
|
||||||
String optionsBody = '''
|
String optionsBody = '''
|
||||||
analyzer:
|
analyzer:
|
||||||
errors:
|
errors:
|
||||||
@ -307,6 +308,8 @@ analyzer:
|
|||||||
todo: ignore
|
todo: ignore
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
|
# we'll turn on avoid_as as soon as it doesn't complain about "as dynamic"
|
||||||
|
# - avoid_as
|
||||||
- camel_case_types
|
- camel_case_types
|
||||||
# sometimes we have no choice (e.g. when matching other platforms)
|
# sometimes we have no choice (e.g. when matching other platforms)
|
||||||
# - constant_identifier_names
|
# - constant_identifier_names
|
||||||
|
Loading…
x
Reference in New Issue
Block a user