Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
292d5aab
Commit
292d5aab
authored
Mar 09, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2550 from Hixie/not-as
Not as
parents
778c3a05
5810cd80
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
57 additions
and
36 deletions
+57
-36
stack_test.dart
packages/flutter/test/rendering/stack_test.dart
+2
-1
asset_vendor_test.dart
packages/flutter/test/widget/asset_vendor_test.dart
+3
-3
build_scope_test.dart
packages/flutter/test/widget/build_scope_test.dart
+4
-2
coordinates_test.dart
packages/flutter/test/widget/coordinates_test.dart
+5
-7
input_test.dart
packages/flutter/test/widget/input_test.dart
+6
-3
parent_data_test.dart
packages/flutter/test/widget/parent_data_test.dart
+2
-1
reparent_state_test.dart
packages/flutter/test/widget/reparent_state_test.dart
+26
-13
instrumentation.dart
packages/flutter_test/lib/src/instrumentation.dart
+2
-2
application_package.dart
packages/flutter_tools/lib/src/application_package.dart
+1
-1
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+6
-3
No files found.
packages/flutter/test/rendering/stack_test.dart
View file @
292d5aab
...
...
@@ -27,7 +27,8 @@ void main() {
);
RenderBox
stack
=
new
RenderStack
(
children:
<
RenderBox
>[
red
,
green
]);
(
green
.
parentData
as
StackParentData
)
StackParentData
greenParentData
=
green
.
parentData
;
greenParentData
..
top
=
0.0
..
right
=
0.0
..
bottom
=
0.0
...
...
packages/flutter/test/widget/asset_vendor_test.dart
View file @
292d5aab
...
...
@@ -69,7 +69,7 @@ class TestAssetBundle extends AssetBundle {
}
Future
<
ui
.
Image
>
testDecodeImageFromDataPipe
(
core
.
MojoDataPipeConsumer
pipe
)
{
TestMojoDataPipeConsumer
testPipe
=
pipe
as
TestMojoDataPipeConsumer
;
TestMojoDataPipeConsumer
testPipe
=
pipe
;
assert
(
testPipe
!=
null
);
ui
.
Image
image
=
new
TestImage
(
testPipe
.
scale
);
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
)
{
return
tester
.
findElementByKey
(
key
).
renderObject
as
RenderImage
;
return
tester
.
findElementByKey
(
key
).
renderObject
;
}
TestImage
getTestImage
(
tester
,
Key
key
)
{
return
getRenderImage
(
tester
,
key
).
image
as
TestImage
;
return
getRenderImage
(
tester
,
key
).
image
;
}
void
pumpTreeToLayout
(
WidgetTester
tester
,
Widget
widget
)
{
...
...
packages/flutter/test/widget/build_scope_test.dart
View file @
292d5aab
...
...
@@ -104,10 +104,12 @@ void main() {
right:
new
ProbeWidget
()
));
expect
(
ProbeWidgetState
.
buildCount
,
equals
(
2
));
(
flipKey
.
currentState
as
FlipComponentState
).
flip
();
FlipComponentState
flipState1
=
flipKey
.
currentState
;
flipState1
.
flip
();
tester
.
pump
();
expect
(
ProbeWidgetState
.
buildCount
,
equals
(
3
));
(
flipKey
.
currentState
as
FlipComponentState
).
flip
();
FlipComponentState
flipState2
=
flipKey
.
currentState
;
flipState2
.
flip
();
tester
.
pump
();
expect
(
ProbeWidgetState
.
buildCount
,
equals
(
3
));
tester
.
pumpWidget
(
new
Container
());
...
...
packages/flutter/test/widget/coordinates_test.dart
View file @
292d5aab
...
...
@@ -38,14 +38,12 @@ void main() {
)
);
expect
((
tester
.
findElementByKey
(
keyA
).
renderObject
as
RenderBox
).
localToGlobal
(
const
Point
(
0.0
,
0.0
)),
equals
(
const
Point
(
100.0
,
100.0
)));
RenderBox
boxA
=
tester
.
findElementByKey
(
keyA
).
renderObject
;
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
)),
equals
(
const
Point
(
100.0
,
200.0
)));
expect
((
tester
.
findElementByKey
(
keyB
).
renderObject
as
RenderBox
).
globalToLocal
(
const
Point
(
110.0
,
205.0
)),
equals
(
const
Point
(
10.0
,
5.0
)));
RenderBox
boxB
=
tester
.
findElementByKey
(
keyB
).
renderObject
;
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
)));
});
});
}
packages/flutter/test/widget/input_test.dart
View file @
292d5aab
...
...
@@ -48,7 +48,8 @@ void main() {
tester
.
pumpWidget
(
builder
());
Element
input
=
tester
.
findElementByKey
(
inputKey
);
Size
emptyInputSize
=
(
input
.
renderObject
as
RenderBox
).
size
;
RenderBox
inputBox
=
input
.
renderObject
;
Size
emptyInputSize
=
inputBox
.
size
;
void
enterText
(
String
testValue
)
{
// Simulate entry of text through the keyboard.
...
...
@@ -65,10 +66,12 @@ void main() {
}
enterText
(
' '
);
expect
((
input
.
renderObject
as
RenderBox
).
size
,
equals
(
emptyInputSize
));
expect
(
input
.
renderObject
,
equals
(
inputBox
));
expect
(
inputBox
.
size
,
equals
(
emptyInputSize
));
enterText
(
'Test'
);
expect
((
input
.
renderObject
as
RenderBox
).
size
,
equals
(
emptyInputSize
));
expect
(
input
.
renderObject
,
equals
(
inputBox
));
expect
(
inputBox
.
size
,
equals
(
emptyInputSize
));
});
});
...
...
packages/flutter/test/widget/parent_data_test.dart
View file @
292d5aab
...
...
@@ -35,7 +35,8 @@ void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
expect
(
parentData
.
right
,
equals
(
expected
.
right
));
expect
(
parentData
.
bottom
,
equals
(
expected
.
bottom
));
expect
(
parentData
.
left
,
equals
(
expected
.
left
));
child
=
(
decoratedBox
.
parentData
as
StackParentData
).
nextSibling
;
StackParentData
decoratedBoxParentData
=
decoratedBox
.
parentData
;
child
=
decoratedBoxParentData
.
nextSibling
;
}
expect
(
child
,
isNull
);
}
catch
(
e
)
{
...
...
packages/flutter/test/widget/reparent_state_test.dart
View file @
292d5aab
...
...
@@ -47,8 +47,10 @@ void main() {
)
);
(
left
.
currentState
as
StateMarkerState
).
marker
=
"left"
;
(
right
.
currentState
as
StateMarkerState
).
marker
=
"right"
;
StateMarkerState
leftState
=
left
.
currentState
;
leftState
.
marker
=
"left"
;
StateMarkerState
rightState
=
right
.
currentState
;
rightState
.
marker
=
"right"
;
StateMarkerState
grandchildState
=
tester
.
findStateByConfig
(
grandchild
);
expect
(
grandchildState
,
isNotNull
);
...
...
@@ -71,8 +73,10 @@ void main() {
)
);
expect
((
left
.
currentState
as
StateMarkerState
).
marker
,
equals
(
"left"
));
expect
((
right
.
currentState
as
StateMarkerState
).
marker
,
equals
(
"right"
));
expect
(
left
.
currentState
,
equals
(
leftState
));
expect
(
leftState
.
marker
,
equals
(
"left"
));
expect
(
right
.
currentState
,
equals
(
rightState
));
expect
(
rightState
.
marker
,
equals
(
"right"
));
StateMarkerState
newGrandchildState
=
tester
.
findStateByConfig
(
newGrandchild
);
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
);
});
});
...
...
@@ -113,8 +118,10 @@ void main() {
)
);
(
left
.
currentState
as
StateMarkerState
).
marker
=
"left"
;
(
right
.
currentState
as
StateMarkerState
).
marker
=
"right"
;
StateMarkerState
leftState
=
left
.
currentState
;
leftState
.
marker
=
"left"
;
StateMarkerState
rightState
=
right
.
currentState
;
rightState
.
marker
=
"right"
;
StateMarkerState
grandchildState
=
tester
.
findStateByConfig
(
grandchild
);
expect
(
grandchildState
,
isNotNull
);
...
...
@@ -133,8 +140,10 @@ void main() {
)
);
expect
((
left
.
currentState
as
StateMarkerState
).
marker
,
equals
(
"left"
));
expect
((
right
.
currentState
as
StateMarkerState
).
marker
,
equals
(
"right"
));
expect
(
left
.
currentState
,
equals
(
leftState
));
expect
(
leftState
.
marker
,
equals
(
"left"
));
expect
(
right
.
currentState
,
equals
(
rightState
));
expect
(
rightState
.
marker
,
equals
(
"right"
));
StateMarkerState
newGrandchildState
=
tester
.
findStateByConfig
(
newGrandchild
);
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
);
});
});
...
...
@@ -163,7 +173,8 @@ void main() {
tester
.
pumpWidget
(
new
StateMarker
(
key:
key
));
(
key
.
currentState
as
StateMarkerState
).
marker
=
"marked"
;
StateMarkerState
keyState
=
key
.
currentState
;
keyState
.
marker
=
"marked"
;
tester
.
pumpWidget
(
new
ScrollableList
(
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
));
expect
((
key
.
currentState
as
StateMarkerState
).
marker
,
equals
(
"marked"
));
expect
(
key
.
currentState
,
equals
(
keyState
));
expect
(
keyState
.
marker
,
equals
(
"marked"
));
});
});
}
packages/flutter_test/lib/src/instrumentation.dart
View file @
292d5aab
...
...
@@ -138,14 +138,14 @@ class Instrumentation {
/// the element's render object has been laid out at least once.
Size
getSize
(
Element
element
)
{
assert
(
element
!=
null
);
RenderBox
box
=
element
.
renderObject
as
RenderBox
;
RenderBox
box
=
element
.
renderObject
;
assert
(
box
!=
null
);
return
box
.
size
;
}
Point
_getElementPoint
(
Element
element
,
SizeToPointFunction
sizeToPoint
)
{
assert
(
element
!=
null
);
RenderBox
box
=
element
.
renderObject
as
RenderBox
;
RenderBox
box
=
element
.
renderObject
;
assert
(
box
!=
null
);
return
box
.
localToGlobal
(
sizeToPoint
(
box
.
size
));
}
...
...
packages/flutter_tools/lib/src/application_package.dart
View file @
292d5aab
...
...
@@ -68,7 +68,7 @@ class AndroidApk extends ApplicationPackage {
String
launchActivity
;
for
(
xml
.
XmlElement
category
in
document
.
findAllElements
(
'category'
))
{
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'
);
launchActivity
=
"
$id
/
$activityName
"
;
break
;
...
...
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
292d5aab
...
...
@@ -294,9 +294,10 @@ class AnalyzeCommand extends FlutterCommand {
for
(
String
package
in
packages
.
keys
)
packagesBody
.
writeln
(
'
$package
:
${path.toUri(packages[package])}
'
);
/// specify analysis options
/// 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)
/// Specify analysis options.
/// 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).
/// For a list of lints, see: http://dart-lang.github.io/linter/lints/
String
optionsBody
=
'''
analyzer:
errors:
...
...
@@ -307,6 +308,8 @@ analyzer:
todo: ignore
linter:
rules:
# we'
ll
turn
on
avoid_as
as
soon
as
it
doesn
't complain about "as dynamic"
# - avoid_as
- camel_case_types
# sometimes we have no choice (e.g. when matching other platforms)
# - constant_identifier_names
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment