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
4bf03c6c
Unverified
Commit
4bf03c6c
authored
Nov 19, 2019
by
Alexandre Ardhuin
Committed by
GitHub
Nov 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implicit-casts:false in flutter_test (#44996)
parent
adc73510
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
116 additions
and
105 deletions
+116
-105
analysis_options.yaml
packages/flutter_test/analysis_options.yaml
+10
-0
_goldens_io.dart
packages/flutter_test/lib/src/_goldens_io.dart
+1
-1
accessibility.dart
packages/flutter_test/lib/src/accessibility.dart
+5
-5
binding.dart
packages/flutter_test/lib/src/binding.dart
+2
-2
controller.dart
packages/flutter_test/lib/src/controller.dart
+12
-12
finders.dart
packages/flutter_test/lib/src/finders.dart
+8
-9
matchers.dart
packages/flutter_test/lib/src/matchers.dart
+33
-32
test_compat.dart
packages/flutter_test/lib/src/test_compat.dart
+11
-10
test_text_input.dart
packages/flutter_test/lib/src/test_text_input.dart
+3
-3
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+19
-19
finders_test.dart
packages/flutter_test/test/finders_test.dart
+1
-1
goldens_test.dart
packages/flutter_test/test/goldens_test.dart
+1
-1
test_async_utils_test.dart
packages/flutter_test/test/test_async_utils_test.dart
+1
-1
config_test_utils.dart
...ages/flutter_test/test/test_config/config_test_utils.dart
+1
-1
widget_tester_test.dart
packages/flutter_test/test/widget_tester_test.dart
+7
-7
window_test.dart
packages/flutter_test/test/window_test.dart
+1
-1
No files found.
packages/flutter_test/analysis_options.yaml
0 → 100644
View file @
4bf03c6c
include
:
../analysis_options.yaml
analyzer
:
strong-mode
:
implicit-casts
:
false
implicit-dynamic
:
false
linter
:
rules
:
avoid_as
:
false
# Disabled so we can gradually migrate to no implicit dynamic.
packages/flutter_test/lib/src/_goldens_io.dart
View file @
4bf03c6c
...
...
@@ -135,7 +135,7 @@ class LocalComparisonOutput {
if
(
result
.
diffs
!=
null
)
{
additionalFeedback
=
'
\n
Failure feedback can be found at '
'
${path.join(basedir.path, 'failures')}
'
;
final
Map
<
String
,
Image
>
diffs
=
result
.
diffs
;
final
Map
<
String
,
Image
>
diffs
=
result
.
diffs
.
cast
<
String
,
Image
>()
;
diffs
.
forEach
((
String
name
,
Image
image
)
{
final
File
output
=
getFailureFile
(
key
.
isEmpty
?
name
:
name
+
'_'
+
key
,
...
...
packages/flutter_test/lib/src/accessibility.dart
View file @
4bf03c6c
...
...
@@ -196,7 +196,7 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline {
Future
<
Evaluation
>
evaluate
(
WidgetTester
tester
)
async
{
final
SemanticsNode
root
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
.
rootSemanticsNode
;
final
RenderView
renderView
=
tester
.
binding
.
renderView
;
final
OffsetLayer
layer
=
renderView
.
debugLayer
;
final
OffsetLayer
layer
=
renderView
.
debugLayer
as
OffsetLayer
;
ui
.
Image
image
;
final
ByteData
byteData
=
await
tester
.
binding
.
runAsync
<
ByteData
>(()
async
{
// Needs to be the same pixel ratio otherwise our dimensions won't match the
...
...
@@ -231,7 +231,7 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline {
Rect
paintBounds
;
if
(
elements
.
length
==
1
)
{
final
Element
element
=
elements
.
single
;
final
RenderBox
renderObject
=
element
.
renderObject
;
final
RenderBox
renderObject
=
element
.
renderObject
as
RenderBox
;
element
.
renderObject
.
paintBounds
;
paintBounds
=
Rect
.
fromPoints
(
renderObject
.
localToGlobal
(
element
.
renderObject
.
paintBounds
.
topLeft
-
const
Offset
(
4.0
,
4.0
)),
...
...
@@ -406,15 +406,15 @@ class _ContrastReport {
if
(
r
<=
0.03928
)
r
/=
12.92
;
else
r
=
math
.
pow
((
r
+
0.055
)/
1.055
,
2.4
);
r
=
math
.
pow
((
r
+
0.055
)/
1.055
,
2.4
)
.
toDouble
()
;
if
(
g
<=
0.03928
)
g
/=
12.92
;
else
g
=
math
.
pow
((
g
+
0.055
)/
1.055
,
2.4
);
g
=
math
.
pow
((
g
+
0.055
)/
1.055
,
2.4
)
.
toDouble
()
;
if
(
b
<=
0.03928
)
b
/=
12.92
;
else
b
=
math
.
pow
((
b
+
0.055
)/
1.055
,
2.4
);
b
=
math
.
pow
((
b
+
0.055
)/
1.055
,
2.4
)
.
toDouble
()
;
return
0.2126
*
r
+
0.7152
*
g
+
0.0722
*
b
;
}
}
...
...
packages/flutter_test/lib/src/binding.dart
View file @
4bf03c6c
...
...
@@ -1335,7 +1335,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
}
@override
_LiveTestRenderView
get
renderView
=>
super
.
renderView
;
_LiveTestRenderView
get
renderView
=>
super
.
renderView
as
_LiveTestRenderView
;
void
_handleViewNeedsPaint
()
{
_viewNeedsPaint
=
true
;
...
...
@@ -1577,7 +1577,7 @@ class _LiveTestRenderView extends RenderView {
})
:
super
(
configuration:
configuration
,
window:
window
);
@override
TestViewConfiguration
get
configuration
=>
super
.
configuration
;
TestViewConfiguration
get
configuration
=>
super
.
configuration
as
TestViewConfiguration
;
@override
set
configuration
(
covariant
TestViewConfiguration
value
)
{
super
.
configuration
=
value
;
}
...
...
packages/flutter_test/lib/src/controller.dart
View file @
4bf03c6c
...
...
@@ -62,7 +62,7 @@ abstract class WidgetController {
/// * Use [widgetList] if you expect to match several widgets and want all of them.
T
widget
<
T
extends
Widget
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
single
.
widget
;
return
finder
.
evaluate
().
single
.
widget
as
T
;
}
/// The first matching widget according to a depth-first pre-order
...
...
@@ -73,7 +73,7 @@ abstract class WidgetController {
/// * Use [widget] if you only expect to match one widget.
T
firstWidget
<
T
extends
Widget
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
first
.
widget
;
return
finder
.
evaluate
().
first
.
widget
as
T
;
}
/// The matching widgets in the widget tree.
...
...
@@ -83,7 +83,7 @@ abstract class WidgetController {
Iterable
<
T
>
widgetList
<
T
extends
Widget
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
map
<
T
>((
Element
element
)
{
final
T
result
=
element
.
widget
;
final
T
result
=
element
.
widget
as
T
;
return
result
;
});
}
...
...
@@ -107,7 +107,7 @@ abstract class WidgetController {
/// * Use [elementList] if you expect to match several elements and want all of them.
T
element
<
T
extends
Element
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
single
;
return
finder
.
evaluate
().
single
as
T
;
}
/// The first matching element according to a depth-first pre-order
...
...
@@ -118,7 +118,7 @@ abstract class WidgetController {
/// * Use [element] if you only expect to match one element.
T
firstElement
<
T
extends
Element
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
first
;
return
finder
.
evaluate
().
first
as
T
;
}
/// The matching elements in the widget tree.
...
...
@@ -127,7 +127,7 @@ abstract class WidgetController {
/// * Use [firstElement] if you expect to match several but only want the first.
Iterable
<
T
>
elementList
<
T
extends
Element
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
();
return
finder
.
evaluate
()
.
cast
<
T
>()
;
}
/// All states currently in the widget tree (lazy pre-order traversal).
...
...
@@ -179,7 +179,7 @@ abstract class WidgetController {
T
_stateOf
<
T
extends
State
>(
Element
element
,
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
if
(
element
is
StatefulElement
)
return
element
.
state
;
return
element
.
state
as
T
;
throw
StateError
(
'Widget of type
${element.widget.runtimeType}
, with
${finder.description}
, is not a StatefulWidget.'
);
}
...
...
@@ -204,7 +204,7 @@ abstract class WidgetController {
/// * Use [renderObjectList] if you expect to match several render objects and want all of them.
T
renderObject
<
T
extends
RenderObject
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
single
.
renderObject
;
return
finder
.
evaluate
().
single
.
renderObject
as
T
;
}
/// The render object of the first matching widget according to a
...
...
@@ -215,7 +215,7 @@ abstract class WidgetController {
/// * Use [renderObject] if you only expect to match one render object.
T
firstRenderObject
<
T
extends
RenderObject
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
first
.
renderObject
;
return
finder
.
evaluate
().
first
.
renderObject
as
T
;
}
/// The render objects of the matching widgets in the widget tree.
...
...
@@ -225,7 +225,7 @@ abstract class WidgetController {
Iterable
<
T
>
renderObjectList
<
T
extends
RenderObject
>(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
return
finder
.
evaluate
().
map
<
T
>((
Element
element
)
{
final
T
result
=
element
.
renderObject
;
final
T
result
=
element
.
renderObject
as
T
;
return
result
;
});
}
...
...
@@ -644,7 +644,7 @@ abstract class WidgetController {
Offset
_getElementPoint
(
Finder
finder
,
Offset
sizeToPoint
(
Size
size
))
{
TestAsyncUtils
.
guardSync
();
final
Element
element
=
finder
.
evaluate
().
single
;
final
RenderBox
box
=
element
.
renderObject
;
final
RenderBox
box
=
element
.
renderObject
as
RenderBox
;
assert
(
box
!=
null
);
return
box
.
localToGlobal
(
sizeToPoint
(
box
.
size
));
}
...
...
@@ -654,7 +654,7 @@ abstract class WidgetController {
Size
getSize
(
Finder
finder
)
{
TestAsyncUtils
.
guardSync
();
final
Element
element
=
finder
.
evaluate
().
single
;
final
RenderBox
box
=
element
.
renderObject
;
final
RenderBox
box
=
element
.
renderObject
as
RenderBox
;
assert
(
box
!=
null
);
return
box
.
size
;
}
...
...
packages/flutter_test/lib/src/finders.dart
View file @
4bf03c6c
...
...
@@ -501,7 +501,7 @@ class _HitTestableFinder extends ChainedFinder {
@override
Iterable
<
Element
>
filter
(
Iterable
<
Element
>
parentCandidates
)
sync
*
{
for
(
final
Element
candidate
in
parentCandidates
)
{
final
RenderBox
box
=
candidate
.
renderObject
;
final
RenderBox
box
=
candidate
.
renderObject
as
RenderBox
;
assert
(
box
!=
null
);
final
Offset
absoluteOffset
=
box
.
localToGlobal
(
alignment
.
alongSize
(
box
.
size
));
final
HitTestResult
hitResult
=
HitTestResult
();
...
...
@@ -544,14 +544,13 @@ class _TextFinder extends MatchFinder {
@override
bool
matches
(
Element
candidate
)
{
if
(
candidate
.
widget
is
Text
)
{
final
Text
textWidget
=
candidate
.
widget
;
if
(
textWidget
.
data
!=
null
)
return
textWidget
.
data
==
text
;
return
textWidget
.
textSpan
.
toPlainText
()
==
text
;
}
else
if
(
candidate
.
widget
is
EditableText
)
{
final
EditableText
editable
=
candidate
.
widget
;
return
editable
.
controller
.
text
==
text
;
final
Widget
widget
=
candidate
.
widget
;
if
(
widget
is
Text
)
{
if
(
widget
.
data
!=
null
)
return
widget
.
data
==
text
;
return
widget
.
textSpan
.
toPlainText
()
==
text
;
}
else
if
(
widget
is
EditableText
)
{
return
widget
.
controller
.
text
==
text
;
}
return
false
;
}
...
...
packages/flutter_test/lib/src/matchers.dart
View file @
4bf03c6c
This diff is collapsed.
Click to expand it.
packages/flutter_test/lib/src/test_compat.dart
View file @
4bf03c6c
...
...
@@ -23,7 +23,7 @@ import 'package:test_api/test_api.dart';
Declarer
_localDeclarer
;
Declarer
get
_declarer
{
final
Declarer
declarer
=
Zone
.
current
[
#test
.
declarer
];
final
Declarer
declarer
=
Zone
.
current
[
#test
.
declarer
]
as
Declarer
;
if
(
declarer
!=
null
)
{
return
declarer
;
}
...
...
@@ -58,9 +58,9 @@ Future<void> _runGroup(Suite suiteConfig, Group group, List<Group> parents, _Rep
if
(
entry
is
Group
)
{
await
_runGroup
(
suiteConfig
,
entry
,
parents
,
reporter
);
}
else
if
(
entry
.
metadata
.
skip
)
{
await
_runSkippedTest
(
suiteConfig
,
entry
,
parents
,
reporter
);
await
_runSkippedTest
(
suiteConfig
,
entry
as
Test
,
parents
,
reporter
);
}
else
{
final
Test
test
=
entry
;
final
Test
test
=
entry
as
Test
;
await
_runLiveTest
(
suiteConfig
,
test
.
load
(
suiteConfig
,
groups:
parents
),
reporter
);
}
}
...
...
@@ -154,7 +154,7 @@ Future<void> _runSkippedTest(Suite suiteConfig, Test test, List<Group> parents,
@isTest
void
test
(
Object
description
,
Function
body
,
{
dynamic
Function
()
body
,
{
String
testOn
,
Timeout
timeout
,
dynamic
skip
,
...
...
@@ -163,7 +163,8 @@ void test(
int
retry
,
})
{
_declarer
.
test
(
description
.
toString
(),
body
,
description
.
toString
(),
body
,
testOn:
testOn
,
timeout:
timeout
,
skip:
skip
,
...
...
@@ -221,7 +222,7 @@ void test(
/// If multiple platforms match, the annotations apply in order as through
/// they were in nested groups.
@isTestGroup
void
group
(
Object
description
,
Function
body
,
{
dynamic
skip
})
{
void
group
(
Object
description
,
void
Function
()
body
,
{
dynamic
skip
})
{
_declarer
.
group
(
description
.
toString
(),
body
,
skip:
skip
);
}
...
...
@@ -236,7 +237,7 @@ void group(Object description, Function body, { dynamic skip }) {
///
/// Each callback at the top level or in a given group will be run in the order
/// they were declared.
void
setUp
(
Function
body
)
{
void
setUp
(
dynamic
Function
()
body
)
{
_declarer
.
setUp
(
body
);
}
...
...
@@ -253,7 +254,7 @@ void setUp(Function body) {
/// reverse of the order they were declared.
///
/// See also [addTearDown], which adds tear-downs to a running test.
void
tearDown
(
Function
body
)
{
void
tearDown
(
dynamic
Function
()
body
)
{
_declarer
.
tearDown
(
body
);
}
...
...
@@ -270,7 +271,7 @@ void tearDown(Function body) {
/// dependencies between tests that should be isolated. In general, you should
/// prefer [setUp], and only use [setUpAll] if the callback is prohibitively
/// slow.
void
setUpAll
(
Function
body
)
{
void
setUpAll
(
dynamic
Function
()
body
)
{
_declarer
.
setUpAll
(
body
);
}
...
...
@@ -285,7 +286,7 @@ void setUpAll(Function body) {
/// dependencies between tests that should be isolated. In general, you should
/// prefer [tearDown], and only use [tearDownAll] if the callback is
/// prohibitively slow.
void
tearDownAll
(
Function
body
)
{
void
tearDownAll
(
dynamic
Function
()
body
)
{
_declarer
.
tearDownAll
(
body
);
}
...
...
packages/flutter_test/lib/src/test_text_input.dart
View file @
4bf03c6c
...
...
@@ -87,8 +87,8 @@ class TestTextInput {
log
.
add
(
methodCall
);
switch
(
methodCall
.
method
)
{
case
'TextInput.setClient'
:
_client
=
methodCall
.
arguments
[
0
];
setClientArgs
=
methodCall
.
arguments
[
1
];
_client
=
methodCall
.
arguments
[
0
]
as
int
;
setClientArgs
=
methodCall
.
arguments
[
1
]
as
Map
<
String
,
dynamic
>
;
break
;
case
'TextInput.clearClient'
:
_client
=
0
;
...
...
@@ -97,7 +97,7 @@ class TestTextInput {
onCleared
();
break
;
case
'TextInput.setEditingState'
:
editingState
=
methodCall
.
arguments
;
editingState
=
methodCall
.
arguments
as
Map
<
String
,
dynamic
>
;
break
;
case
'TextInput.show'
:
_isVisible
=
true
;
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
4bf03c6c
...
...
@@ -107,7 +107,7 @@ void testWidgets(
Duration
initialTimeout
,
bool
semanticsEnabled
=
true
,
})
{
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
()
as
TestWidgetsFlutterBinding
;
final
WidgetTester
tester
=
WidgetTester
.
_
(
binding
);
test
(
description
,
...
...
@@ -198,7 +198,7 @@ Future<void> benchmarkWidgets(
print
(
'└─────────────────────────────────────────────────╌┄┈ 🐢'
);
return
true
;
}());
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
()
as
TestWidgetsFlutterBinding
;
assert
(
binding
is
!
AutomatedTestWidgetsFlutterBinding
);
final
WidgetTester
tester
=
WidgetTester
.
_
(
binding
);
SemanticsHandle
semanticsHandle
;
...
...
@@ -284,7 +284,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
/// The binding instance used by the testing framework.
@override
TestWidgetsFlutterBinding
get
binding
=>
super
.
binding
;
TestWidgetsFlutterBinding
get
binding
=>
super
.
binding
as
TestWidgetsFlutterBinding
;
/// Renders the UI from the given [widget].
///
...
...
@@ -485,9 +485,10 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
@override
void
dispatchEvent
(
PointerEvent
event
,
HitTestResult
result
)
{
if
(
event
is
PointerDownEvent
)
{
final
RenderObject
innerTarget
=
result
.
path
.
firstWhere
(
(
HitTestEntry
candidate
)
=>
candidate
.
target
is
RenderObject
,
).
target
;
final
RenderObject
innerTarget
=
result
.
path
.
map
((
HitTestEntry
candidate
)
=>
candidate
.
target
)
.
whereType
<
RenderObject
>()
.
first
;
final
Element
innerTargetElement
=
collectAllElementsFrom
(
binding
.
renderViewElement
,
skipOffstage:
true
,
...
...
@@ -515,8 +516,8 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
break
;
totalNumber
+=
1
;
// optimistically assume we'll be able to describe it
if
(
element
.
widget
is
Tooltip
)
{
final
Tooltip
widget
=
element
.
widget
;
final
Widget
widget
=
element
.
widget
;
if
(
widget
is
Tooltip
)
{
final
Iterable
<
Element
>
matches
=
find
.
byTooltip
(
widget
.
message
).
evaluate
();
if
(
matches
.
length
==
1
)
{
debugPrint
(
' find.byTooltip(
\'
${widget.message}
\'
)'
);
...
...
@@ -524,9 +525,8 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
}
}
if
(
element
.
widget
is
Text
)
{
if
(
widget
is
Text
)
{
assert
(
descendantText
==
null
);
final
Text
widget
=
element
.
widget
;
final
Iterable
<
Element
>
matches
=
find
.
text
(
widget
.
data
).
evaluate
();
descendantText
=
widget
.
data
;
if
(
matches
.
length
==
1
)
{
...
...
@@ -535,13 +535,13 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
}
}
if
(
element
.
widget
.
key
is
ValueKey
<
dynamic
>)
{
final
ValueKey
<
dynamic
>
key
=
element
.
widget
.
key
;
final
Key
key
=
widget
.
key
;
if
(
key
is
ValueKey
<
dynamic
>)
{
String
keyLabel
;
if
(
key
is
ValueKey
<
int
>
||
key
is
ValueKey
<
double
>
||
key
is
ValueKey
<
bool
>)
{
keyLabel
=
'const
${
element.widget.
key.runtimeType}
(
${key.value}
)'
;
keyLabel
=
'const
${key.runtimeType}
(
${key.value}
)'
;
}
else
if
(
key
is
ValueKey
<
String
>)
{
keyLabel
=
'const Key(
\'
${key.value}
\'
)'
;
}
...
...
@@ -554,20 +554,20 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
}
}
if
(!
_isPrivate
(
element
.
widget
.
runtimeType
))
{
if
(!
_isPrivate
(
widget
.
runtimeType
))
{
if
(
numberOfTypes
<
5
)
{
final
Iterable
<
Element
>
matches
=
find
.
byType
(
element
.
widget
.
runtimeType
).
evaluate
();
final
Iterable
<
Element
>
matches
=
find
.
byType
(
widget
.
runtimeType
).
evaluate
();
if
(
matches
.
length
==
1
)
{
debugPrint
(
' find.byType(
${
element.
widget.runtimeType}
)'
);
debugPrint
(
' find.byType(
${widget.runtimeType}
)'
);
numberOfTypes
+=
1
;
continue
;
}
}
if
(
descendantText
!=
null
&&
numberOfWithTexts
<
5
)
{
final
Iterable
<
Element
>
matches
=
find
.
widgetWithText
(
element
.
widget
.
runtimeType
,
descendantText
).
evaluate
();
final
Iterable
<
Element
>
matches
=
find
.
widgetWithText
(
widget
.
runtimeType
,
descendantText
).
evaluate
();
if
(
matches
.
length
==
1
)
{
debugPrint
(
' find.widgetWithText(
${
element.
widget.runtimeType}
,
\'
$descendantText
\'
)'
);
debugPrint
(
' find.widgetWithText(
${widget.runtimeType}
,
\'
$descendantText
\'
)'
);
numberOfWithTexts
+=
1
;
continue
;
}
...
...
@@ -842,7 +842,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
RenderObject
renderObject
=
element
.
findRenderObject
();
SemanticsNode
result
=
renderObject
.
debugSemantics
;
while
(
renderObject
!=
null
&&
result
==
null
)
{
renderObject
=
renderObject
?.
parent
;
renderObject
=
renderObject
?.
parent
as
RenderObject
;
result
=
renderObject
?.
debugSemantics
;
}
if
(
result
==
null
)
...
...
packages/flutter_test/test/finders_test.dart
View file @
4bf03c6c
...
...
@@ -128,7 +128,7 @@ void main() {
final
Text
text
=
find
.
descendant
(
of:
find
.
byKey
(
key1
),
matching:
find
.
byType
(
Text
),
).
last
.
evaluate
().
single
.
widget
;
).
last
.
evaluate
().
single
.
widget
as
Text
;
expect
(
text
.
data
,
'1'
);
});
...
...
packages/flutter_test/test/goldens_test.dart
View file @
4bf03c6c
...
...
@@ -77,7 +77,7 @@ void main() {
test
(
'is initialized by test framework'
,
()
{
expect
(
goldenFileComparator
,
isNotNull
);
expect
(
goldenFileComparator
,
isInstanceOf
<
LocalFileComparator
>());
final
LocalFileComparator
comparator
=
goldenFileComparator
;
final
LocalFileComparator
comparator
=
goldenFileComparator
as
LocalFileComparator
;
expect
(
comparator
.
basedir
.
path
,
contains
(
'flutter_test'
));
});
});
...
...
packages/flutter_test/test/test_async_utils_test.dart
View file @
4bf03c6c
...
...
@@ -159,7 +159,7 @@ void main() {
real_test
.
expect
(
information
[
3
],
isInstanceOf
<
DiagnosticsProperty
<
void
>>());
real_test
.
expect
(
information
[
4
],
isInstanceOf
<
DiagnosticsProperty
<
void
>>());
real_test
.
expect
(
information
[
5
],
isInstanceOf
<
DiagnosticsStackTrace
>());
final
DiagnosticsStackTrace
stackTraceProperty
=
information
[
5
];
final
DiagnosticsStackTrace
stackTraceProperty
=
information
[
5
]
as
DiagnosticsStackTrace
;
real_test
.
expect
(
stackTraceProperty
.
name
,
'
\n
When the first method was called, this was the stack'
);
real_test
.
expect
(
stackTraceProperty
.
value
,
isInstanceOf
<
StackTrace
>());
}
...
...
packages/flutter_test/test/test_config/config_test_utils.dart
View file @
4bf03c6c
...
...
@@ -11,7 +11,7 @@ void testConfig(
String
expectedStringValue
,
{
Map
<
Type
,
dynamic
>
otherExpectedValues
=
const
<
Type
,
dynamic
>{
int
:
isNull
},
})
{
final
String
actualStringValue
=
Zone
.
current
[
String
];
final
String
actualStringValue
=
Zone
.
current
[
String
]
as
String
;
final
Map
<
Type
,
dynamic
>
otherActualValues
=
otherExpectedValues
.
map
<
Type
,
dynamic
>(
(
Type
key
,
dynamic
value
)
{
return
MapEntry
<
Type
,
dynamic
>(
key
,
Zone
.
current
[
key
]);
...
...
packages/flutter_test/test/widget_tester_test.dart
View file @
4bf03c6c
...
...
@@ -193,7 +193,7 @@ void main() {
TestFailure
failure
;
try
{
expect
(
find
.
text
(
'foo'
,
skipOffstage:
false
),
findsOneWidget
);
}
catch
(
e
)
{
}
on
TestFailure
catch
(
e
)
{
failure
=
e
;
}
...
...
@@ -216,7 +216,7 @@ void main() {
TestFailure
failure
;
try
{
expect
(
find
.
text
(
'foo'
,
skipOffstage:
false
),
findsNothing
);
}
catch
(
e
)
{
}
on
TestFailure
catch
(
e
)
{
failure
=
e
;
}
...
...
@@ -234,7 +234,7 @@ void main() {
TestFailure
failure
;
try
{
expect
(
find
.
text
(
'foo'
),
findsNothing
);
}
catch
(
e
)
{
}
on
TestFailure
catch
(
e
)
{
failure
=
e
;
}
...
...
@@ -289,7 +289,7 @@ void main() {
TestFailure
failure
;
try
{
expect
(
find
.
byElementPredicate
((
_
)
=>
false
,
description:
customDescription
),
findsOneWidget
);
}
catch
(
e
)
{
}
on
TestFailure
catch
(
e
)
{
failure
=
e
;
}
...
...
@@ -306,7 +306,7 @@ void main() {
TestFailure
failure
;
try
{
expect
(
find
.
byWidgetPredicate
((
_
)
=>
false
,
description:
customDescription
),
findsOneWidget
);
}
catch
(
e
)
{
}
on
TestFailure
catch
(
e
)
{
failure
=
e
;
}
...
...
@@ -360,7 +360,7 @@ void main() {
of:
find
.
widgetWithText
(
Column
,
'foo'
),
matching:
find
.
text
(
'bar'
),
),
findsOneWidget
);
}
catch
(
e
)
{
}
on
TestFailure
catch
(
e
)
{
failure
=
e
;
}
...
...
@@ -422,7 +422,7 @@ void main() {
of:
find
.
text
(
'bar'
),
matching:
find
.
widgetWithText
(
Column
,
'foo'
),
),
findsOneWidget
);
}
catch
(
e
)
{
}
on
TestFailure
catch
(
e
)
{
failure
=
e
;
}
...
...
packages/flutter_test/test/window_test.dart
View file @
4bf03c6c
...
...
@@ -224,7 +224,7 @@ void verifyThatTestWindowCanFakeProperty<WindowPropertyType>({
TestWidgetsFlutterBinding
retrieveTestBinding
(
WidgetTester
tester
)
{
final
WidgetsBinding
binding
=
tester
.
binding
;
assert
(
binding
is
TestWidgetsFlutterBinding
);
final
TestWidgetsFlutterBinding
testBinding
=
binding
;
final
TestWidgetsFlutterBinding
testBinding
=
binding
as
TestWidgetsFlutterBinding
;
return
testBinding
;
}
...
...
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