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
83720015
Unverified
Commit
83720015
authored
Jan 20, 2023
by
Michael Goderbauer
Committed by
GitHub
Jan 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary null checks in flutter_test (#118865)
parent
c0ad6add
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
10 additions
and
44 deletions
+10
-44
accessibility.dart
packages/flutter_test/lib/src/accessibility.dart
+1
-1
all_elements.dart
packages/flutter_test/lib/src/all_elements.dart
+0
-1
animation_sheet.dart
packages/flutter_test/lib/src/animation_sheet.dart
+2
-5
binding.dart
packages/flutter_test/lib/src/binding.dart
+1
-7
controller.dart
packages/flutter_test/lib/src/controller.dart
+1
-11
finders.dart
packages/flutter_test/lib/src/finders.dart
+1
-1
frame_timing_summarizer.dart
packages/flutter_test/lib/src/frame_timing_summarizer.dart
+0
-1
image.dart
packages/flutter_test/lib/src/image.dart
+2
-3
matchers.dart
packages/flutter_test/lib/src/matchers.dart
+1
-1
stack_manipulation.dart
packages/flutter_test/lib/src/stack_manipulation.dart
+0
-1
test_async_utils.dart
packages/flutter_test/lib/src/test_async_utils.dart
+0
-3
test_default_binary_messenger.dart
...s/flutter_test/lib/src/test_default_binary_messenger.dart
+1
-1
test_exception_reporter.dart
packages/flutter_test/lib/src/test_exception_reporter.dart
+0
-1
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+0
-7
No files found.
packages/flutter_test/lib/src/accessibility.dart
View file @
83720015
...
@@ -229,7 +229,7 @@ class LabeledTapTargetGuideline extends AccessibilityGuideline {
...
@@ -229,7 +229,7 @@ class LabeledTapTargetGuideline extends AccessibilityGuideline {
!
data
.
hasAction
(
ui
.
SemanticsAction
.
tap
))
{
!
data
.
hasAction
(
ui
.
SemanticsAction
.
tap
))
{
return
result
;
return
result
;
}
}
if
((
data
.
label
==
null
||
data
.
label
.
isEmpty
)
&&
(
data
.
tooltip
==
null
||
data
.
tooltip
.
isEmpty
))
{
if
((
data
.
label
.
isEmpty
)
&&
(
data
.
tooltip
.
isEmpty
))
{
result
+=
Evaluation
.
fail
(
result
+=
Evaluation
.
fail
(
'
$node
: expected tappable node to have semantic label, '
'
$node
: expected tappable node to have semantic label, '
'but none was found.
\n
'
,
'but none was found.
\n
'
,
...
...
packages/flutter_test/lib/src/all_elements.dart
View file @
83720015
...
@@ -73,7 +73,6 @@ class _DepthFirstChildIterator implements Iterator<Element> {
...
@@ -73,7 +73,6 @@ class _DepthFirstChildIterator implements Iterator<Element> {
}
}
void
_fillChildren
(
Element
element
)
{
void
_fillChildren
(
Element
element
)
{
assert
(
element
!=
null
);
// If we did not have to follow LTR order and could instead use RTL,
// If we did not have to follow LTR order and could instead use RTL,
// we could avoid reversing this and the operation would be measurably
// we could avoid reversing this and the operation would be measurably
// faster. Unfortunately, a lot of tests depend on LTR order.
// faster. Unfortunately, a lot of tests depend on LTR order.
...
...
packages/flutter_test/lib/src/animation_sheet.dart
View file @
83720015
...
@@ -89,8 +89,7 @@ class AnimationSheetBuilder {
...
@@ -89,8 +89,7 @@ class AnimationSheetBuilder {
AnimationSheetBuilder
({
AnimationSheetBuilder
({
required
this
.
frameSize
,
required
this
.
frameSize
,
this
.
allLayers
=
false
,
this
.
allLayers
=
false
,
})
:
assert
(!
kIsWeb
),
// Does not support Web. See [AnimationSheetBuilder].
})
:
assert
(!
kIsWeb
);
assert
(
frameSize
!=
null
);
/// The size of the child to be recorded.
/// The size of the child to be recorded.
///
///
...
@@ -150,7 +149,6 @@ class AnimationSheetBuilder {
...
@@ -150,7 +149,6 @@ class AnimationSheetBuilder {
Key
?
key
,
Key
?
key
,
bool
recording
=
true
,
bool
recording
=
true
,
})
{
})
{
assert
(
child
!=
null
);
return
_AnimationSheetRecorder
(
return
_AnimationSheetRecorder
(
key:
key
,
key:
key
,
size:
frameSize
,
size:
frameSize
,
...
@@ -454,8 +452,7 @@ class _CellSheet extends StatelessWidget {
...
@@ -454,8 +452,7 @@ class _CellSheet extends StatelessWidget {
super
.
key
,
super
.
key
,
required
this
.
cellSize
,
required
this
.
cellSize
,
required
this
.
children
,
required
this
.
children
,
})
:
assert
(
cellSize
!=
null
),
})
:
assert
(
children
.
isNotEmpty
);
assert
(
children
!=
null
&&
children
.
isNotEmpty
);
final
Size
cellSize
;
final
Size
cellSize
;
final
List
<
Widget
>
children
;
final
List
<
Widget
>
children
;
...
...
packages/flutter_test/lib/src/binding.dart
View file @
83720015
...
@@ -772,7 +772,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
...
@@ -772,7 +772,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
VoidCallback
invariantTester
,
VoidCallback
invariantTester
,
String
description
,
String
description
,
)
{
)
{
assert
(
description
!=
null
);
assert
(
inTest
);
assert
(
inTest
);
// Set the handler only if there is currently none.
// Set the handler only if there is currently none.
...
@@ -1194,7 +1193,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
...
@@ -1194,7 +1193,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
Future
<
T
>
Function
()
callback
,
{
Future
<
T
>
Function
()
callback
,
{
Duration
additionalTime
=
const
Duration
(
milliseconds:
1000
),
Duration
additionalTime
=
const
Duration
(
milliseconds:
1000
),
})
{
})
{
assert
(
additionalTime
!=
null
);
assert
(()
{
assert
(()
{
if
(
_pendingAsyncTasks
==
null
)
{
if
(
_pendingAsyncTasks
==
null
)
{
return
true
;
return
true
;
...
@@ -1335,7 +1333,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
...
@@ -1335,7 +1333,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
debugBuildingDirtyElements
=
true
;
debugBuildingDirtyElements
=
true
;
buildOwner
!.
buildScope
(
renderViewElement
!);
buildOwner
!.
buildScope
(
renderViewElement
!);
if
(
_phase
!=
EnginePhase
.
build
)
{
if
(
_phase
!=
EnginePhase
.
build
)
{
assert
(
renderView
!=
null
);
pipelineOwner
.
flushLayout
();
pipelineOwner
.
flushLayout
();
if
(
_phase
!=
EnginePhase
.
layout
)
{
if
(
_phase
!=
EnginePhase
.
layout
)
{
pipelineOwner
.
flushCompositingBits
();
pipelineOwner
.
flushCompositingBits
();
...
@@ -1383,7 +1380,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
...
@@ -1383,7 +1380,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
)
)
Duration
?
timeout
,
Duration
?
timeout
,
})
{
})
{
assert
(
description
!=
null
);
assert
(!
inTest
);
assert
(!
inTest
);
assert
(
_currentFakeAsync
==
null
);
assert
(
_currentFakeAsync
==
null
);
assert
(
_clock
==
null
);
assert
(
_clock
==
null
);
...
@@ -1885,7 +1881,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
...
@@ -1885,7 +1881,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
)
)
Duration
?
timeout
,
Duration
?
timeout
,
})
{
})
{
assert
(
description
!=
null
);
assert
(!
inTest
);
assert
(!
inTest
);
_inTest
=
true
;
_inTest
=
true
;
_liveTestRenderView
.
_setDescription
(
description
);
_liveTestRenderView
.
_setDescription
(
description
);
...
@@ -2038,7 +2033,6 @@ class _LiveTestRenderView extends RenderView {
...
@@ -2038,7 +2033,6 @@ class _LiveTestRenderView extends RenderView {
fontSize:
10.0
,
fontSize:
10.0
,
);
);
void
_setDescription
(
String
value
)
{
void
_setDescription
(
String
value
)
{
assert
(
value
!=
null
);
if
(
value
.
isEmpty
)
{
if
(
value
.
isEmpty
)
{
_label
=
null
;
_label
=
null
;
return
;
return
;
...
@@ -2081,7 +2075,7 @@ class _LiveTestRenderView extends RenderView {
...
@@ -2081,7 +2075,7 @@ class _LiveTestRenderView extends RenderView {
.
where
((
int
pointer
)
=>
_pointers
[
pointer
]!.
decay
==
0
)
.
where
((
int
pointer
)
=>
_pointers
[
pointer
]!.
decay
==
0
)
.
toList
()
.
toList
()
.
forEach
(
_pointers
.
remove
);
.
forEach
(
_pointers
.
remove
);
if
(
dirty
&&
onNeedPaint
!=
null
)
{
if
(
dirty
)
{
scheduleMicrotask
(
onNeedPaint
);
scheduleMicrotask
(
onNeedPaint
);
}
}
}
}
...
...
packages/flutter_test/lib/src/controller.dart
View file @
83720015
...
@@ -890,7 +890,6 @@ abstract class WidgetController {
...
@@ -890,7 +890,6 @@ abstract class WidgetController {
assert
(
kDragSlopDefault
>
kTouchSlop
);
assert
(
kDragSlopDefault
>
kTouchSlop
);
return
TestAsyncUtils
.
guard
<
void
>(()
async
{
return
TestAsyncUtils
.
guard
<
void
>(()
async
{
final
TestGesture
gesture
=
await
startGesture
(
startLocation
,
pointer:
pointer
,
buttons:
buttons
,
kind:
kind
);
final
TestGesture
gesture
=
await
startGesture
(
startLocation
,
pointer:
pointer
,
buttons:
buttons
,
kind:
kind
);
assert
(
gesture
!=
null
);
final
double
xSign
=
offset
.
dx
.
sign
;
final
double
xSign
=
offset
.
dx
.
sign
;
final
double
ySign
=
offset
.
dy
.
sign
;
final
double
ySign
=
offset
.
dy
.
sign
;
...
@@ -1120,7 +1119,6 @@ abstract class WidgetController {
...
@@ -1120,7 +1119,6 @@ abstract class WidgetController {
PointerDeviceKind
kind
=
PointerDeviceKind
.
touch
,
PointerDeviceKind
kind
=
PointerDeviceKind
.
touch
,
int
buttons
=
kPrimaryButton
,
int
buttons
=
kPrimaryButton
,
})
async
{
})
async
{
assert
(
downLocation
!=
null
);
final
TestGesture
result
=
await
createGesture
(
final
TestGesture
result
=
await
createGesture
(
pointer:
pointer
,
pointer:
pointer
,
kind:
kind
,
kind:
kind
,
...
@@ -1268,9 +1266,7 @@ abstract class WidgetController {
...
@@ -1268,9 +1266,7 @@ abstract class WidgetController {
}
}
if
(!
found
)
{
if
(!
found
)
{
bool
outOfBounds
=
false
;
bool
outOfBounds
=
false
;
if
(
binding
.
renderView
!=
null
&&
binding
.
renderView
.
size
!=
null
)
{
outOfBounds
=
!(
Offset
.
zero
&
binding
.
renderView
.
size
).
contains
(
location
);
outOfBounds
=
!(
Offset
.
zero
&
binding
.
renderView
.
size
).
contains
(
location
);
}
if
(
hitTestWarningShouldBeFatal
)
{
if
(
hitTestWarningShouldBeFatal
)
{
throw
FlutterError
.
fromParts
(<
DiagnosticsNode
>[
throw
FlutterError
.
fromParts
(<
DiagnosticsNode
>[
ErrorSummary
(
'Finder specifies a widget that would not receive pointer events.'
),
ErrorSummary
(
'Finder specifies a widget that would not receive pointer events.'
),
...
@@ -1349,7 +1345,6 @@ abstract class WidgetController {
...
@@ -1349,7 +1345,6 @@ abstract class WidgetController {
String
?
character
,
String
?
character
,
PhysicalKeyboardKey
?
physicalKey
PhysicalKeyboardKey
?
physicalKey
})
async
{
})
async
{
assert
(
platform
!=
null
);
final
bool
handled
=
await
simulateKeyDownEvent
(
key
,
platform:
platform
,
character:
character
,
physicalKey:
physicalKey
);
final
bool
handled
=
await
simulateKeyDownEvent
(
key
,
platform:
platform
,
character:
character
,
physicalKey:
physicalKey
);
// Internally wrapped in async guard.
// Internally wrapped in async guard.
await
simulateKeyUpEvent
(
key
,
platform:
platform
,
physicalKey:
physicalKey
);
await
simulateKeyUpEvent
(
key
,
platform:
platform
,
physicalKey:
physicalKey
);
...
@@ -1393,7 +1388,6 @@ abstract class WidgetController {
...
@@ -1393,7 +1388,6 @@ abstract class WidgetController {
String
?
character
,
String
?
character
,
PhysicalKeyboardKey
?
physicalKey
PhysicalKeyboardKey
?
physicalKey
})
async
{
})
async
{
assert
(
platform
!=
null
);
// Internally wrapped in async guard.
// Internally wrapped in async guard.
return
simulateKeyDownEvent
(
key
,
platform:
platform
,
character:
character
,
physicalKey:
physicalKey
);
return
simulateKeyDownEvent
(
key
,
platform:
platform
,
character:
character
,
physicalKey:
physicalKey
);
}
}
...
@@ -1427,7 +1421,6 @@ abstract class WidgetController {
...
@@ -1427,7 +1421,6 @@ abstract class WidgetController {
String
platform
=
_defaultPlatform
,
String
platform
=
_defaultPlatform
,
PhysicalKeyboardKey
?
physicalKey
PhysicalKeyboardKey
?
physicalKey
})
async
{
})
async
{
assert
(
platform
!=
null
);
// Internally wrapped in async guard.
// Internally wrapped in async guard.
return
simulateKeyUpEvent
(
key
,
platform:
platform
,
physicalKey:
physicalKey
);
return
simulateKeyUpEvent
(
key
,
platform:
platform
,
physicalKey:
physicalKey
);
}
}
...
@@ -1469,7 +1462,6 @@ abstract class WidgetController {
...
@@ -1469,7 +1462,6 @@ abstract class WidgetController {
String
?
character
,
String
?
character
,
PhysicalKeyboardKey
?
physicalKey
PhysicalKeyboardKey
?
physicalKey
})
async
{
})
async
{
assert
(
platform
!=
null
);
// Internally wrapped in async guard.
// Internally wrapped in async guard.
return
simulateKeyRepeatEvent
(
key
,
platform:
platform
,
character:
character
,
physicalKey:
physicalKey
);
return
simulateKeyRepeatEvent
(
key
,
platform:
platform
,
character:
character
,
physicalKey:
physicalKey
);
}
}
...
@@ -1627,7 +1619,6 @@ class LiveWidgetController extends WidgetController {
...
@@ -1627,7 +1619,6 @@ class LiveWidgetController extends WidgetController {
Future
<
int
>
pumpAndSettle
([
Future
<
int
>
pumpAndSettle
([
Duration
duration
=
const
Duration
(
milliseconds:
100
),
Duration
duration
=
const
Duration
(
milliseconds:
100
),
])
{
])
{
assert
(
duration
!=
null
);
assert
(
duration
>
Duration
.
zero
);
assert
(
duration
>
Duration
.
zero
);
return
TestAsyncUtils
.
guard
<
int
>(()
async
{
return
TestAsyncUtils
.
guard
<
int
>(()
async
{
int
count
=
0
;
int
count
=
0
;
...
@@ -1641,7 +1632,6 @@ class LiveWidgetController extends WidgetController {
...
@@ -1641,7 +1632,6 @@ class LiveWidgetController extends WidgetController {
@override
@override
Future
<
List
<
Duration
>>
handlePointerEventRecord
(
List
<
PointerEventRecord
>
records
)
{
Future
<
List
<
Duration
>>
handlePointerEventRecord
(
List
<
PointerEventRecord
>
records
)
{
assert
(
records
!=
null
);
assert
(
records
.
isNotEmpty
);
assert
(
records
.
isNotEmpty
);
return
TestAsyncUtils
.
guard
<
List
<
Duration
>>(()
async
{
return
TestAsyncUtils
.
guard
<
List
<
Duration
>>(()
async
{
final
List
<
Duration
>
handleTimeStampDiff
=
<
Duration
>[];
final
List
<
Duration
>
handleTimeStampDiff
=
<
Duration
>[];
...
...
packages/flutter_test/lib/src/finders.dart
View file @
83720015
...
@@ -567,7 +567,7 @@ abstract class Finder {
...
@@ -567,7 +567,7 @@ abstract class Finder {
/// Applies additional filtering against a [parent] [Finder].
/// Applies additional filtering against a [parent] [Finder].
abstract
class
ChainedFinder
extends
Finder
{
abstract
class
ChainedFinder
extends
Finder
{
/// Create a Finder chained against the candidates of another [Finder].
/// Create a Finder chained against the candidates of another [Finder].
ChainedFinder
(
this
.
parent
)
:
assert
(
parent
!=
null
)
;
ChainedFinder
(
this
.
parent
);
/// Another [Finder] that will run first.
/// Another [Finder] that will run first.
final
Finder
parent
;
final
Finder
parent
;
...
...
packages/flutter_test/lib/src/frame_timing_summarizer.dart
View file @
83720015
...
@@ -22,7 +22,6 @@ class FrameTimingSummarizer {
...
@@ -22,7 +22,6 @@ class FrameTimingSummarizer {
int
?
newGenGCCount
,
int
?
newGenGCCount
,
int
?
oldGenGCCount
,
int
?
oldGenGCCount
,
})
{
})
{
assert
(
data
!=
null
);
assert
(
data
.
isNotEmpty
);
assert
(
data
.
isNotEmpty
);
final
List
<
Duration
>
frameBuildTime
=
List
<
Duration
>.
unmodifiable
(
final
List
<
Duration
>
frameBuildTime
=
List
<
Duration
>.
unmodifiable
(
data
.
map
<
Duration
>((
FrameTiming
datum
)
=>
datum
.
buildDuration
),
data
.
map
<
Duration
>((
FrameTiming
datum
)
=>
datum
.
buildDuration
),
...
...
packages/flutter_test/lib/src/image.dart
View file @
83720015
...
@@ -29,9 +29,8 @@ Future<ui.Image> createTestImage({
...
@@ -29,9 +29,8 @@ Future<ui.Image> createTestImage({
int
height
=
1
,
int
height
=
1
,
bool
cache
=
true
,
bool
cache
=
true
,
})
=>
TestAsyncUtils
.
guard
(()
async
{
})
=>
TestAsyncUtils
.
guard
(()
async
{
assert
(
width
!=
null
&&
width
>
0
);
assert
(
width
>
0
);
assert
(
height
!=
null
&&
height
>
0
);
assert
(
height
>
0
);
assert
(
cache
!=
null
);
final
int
cacheKey
=
Object
.
hash
(
width
,
height
);
final
int
cacheKey
=
Object
.
hash
(
width
,
height
);
if
(
cache
&&
_cache
.
containsKey
(
cacheKey
))
{
if
(
cache
&&
_cache
.
containsKey
(
cacheKey
))
{
...
...
packages/flutter_test/lib/src/matchers.dart
View file @
83720015
...
@@ -1981,7 +1981,7 @@ class _CoversSameAreaAs extends Matcher {
...
@@ -1981,7 +1981,7 @@ class _CoversSameAreaAs extends Matcher {
class
_ColorMatcher
extends
Matcher
{
class
_ColorMatcher
extends
Matcher
{
const
_ColorMatcher
({
const
_ColorMatcher
({
required
this
.
targetColor
,
required
this
.
targetColor
,
})
:
assert
(
targetColor
!=
null
)
;
});
final
Color
targetColor
;
final
Color
targetColor
;
...
...
packages/flutter_test/lib/src/stack_manipulation.dart
View file @
83720015
...
@@ -26,7 +26,6 @@ int reportExpectCall(StackTrace stack, List<DiagnosticsNode> information) {
...
@@ -26,7 +26,6 @@ int reportExpectCall(StackTrace stack, List<DiagnosticsNode> information) {
line2
.
firstMatch
(
stackLines
[
2
])
!=
null
&&
line2
.
firstMatch
(
stackLines
[
2
])
!=
null
&&
line3
.
firstMatch
(
stackLines
[
3
])
!=
null
)
{
line3
.
firstMatch
(
stackLines
[
3
])
!=
null
)
{
final
Match
expectMatch
=
line4
.
firstMatch
(
stackLines
[
4
])!;
final
Match
expectMatch
=
line4
.
firstMatch
(
stackLines
[
4
])!;
assert
(
expectMatch
!=
null
);
assert
(
expectMatch
.
groupCount
==
2
);
assert
(
expectMatch
.
groupCount
==
2
);
information
.
add
(
DiagnosticsStackTrace
.
singleFrame
(
information
.
add
(
DiagnosticsStackTrace
.
singleFrame
(
'This was caught by the test expectation on the following line'
,
'This was caught by the test expectation on the following line'
,
...
...
packages/flutter_test/lib/src/test_async_utils.dart
View file @
83720015
...
@@ -187,10 +187,7 @@ class TestAsyncUtils {
...
@@ -187,10 +187,7 @@ class TestAsyncUtils {
return
;
return
;
}
}
candidateScope
=
_scopeStack
[
_scopeStack
.
length
-
skipCount
-
1
];
candidateScope
=
_scopeStack
[
_scopeStack
.
length
-
skipCount
-
1
];
assert
(
candidateScope
!=
null
);
assert
(
candidateScope
.
zone
!=
null
);
}
while
(
candidateScope
.
zone
!=
zone
);
}
while
(
candidateScope
.
zone
!=
zone
);
assert
(
scope
!=
null
);
final
List
<
DiagnosticsNode
>
information
=
<
DiagnosticsNode
>[
final
List
<
DiagnosticsNode
>
information
=
<
DiagnosticsNode
>[
ErrorSummary
(
'Guarded function conflict.'
),
ErrorSummary
(
'Guarded function conflict.'
),
ErrorHint
(
'You must use "await" with all Future-returning test APIs.'
),
ErrorHint
(
'You must use "await" with all Future-returning test APIs.'
),
...
...
packages/flutter_test/lib/src/test_default_binary_messenger.dart
View file @
83720015
...
@@ -46,7 +46,7 @@ class TestDefaultBinaryMessenger extends BinaryMessenger {
...
@@ -46,7 +46,7 @@ class TestDefaultBinaryMessenger extends BinaryMessenger {
/// Creates a [TestDefaultBinaryMessenger] instance.
/// Creates a [TestDefaultBinaryMessenger] instance.
///
///
/// The [delegate] instance must not be null.
/// The [delegate] instance must not be null.
TestDefaultBinaryMessenger
(
this
.
delegate
)
:
assert
(
delegate
!=
null
)
;
TestDefaultBinaryMessenger
(
this
.
delegate
);
/// The delegate [BinaryMessenger].
/// The delegate [BinaryMessenger].
final
BinaryMessenger
delegate
;
final
BinaryMessenger
delegate
;
...
...
packages/flutter_test/lib/src/test_exception_reporter.dart
View file @
83720015
...
@@ -24,7 +24,6 @@ typedef TestExceptionReporter = void Function(FlutterErrorDetails details, Strin
...
@@ -24,7 +24,6 @@ typedef TestExceptionReporter = void Function(FlutterErrorDetails details, Strin
TestExceptionReporter
get
reportTestException
=>
_reportTestException
;
TestExceptionReporter
get
reportTestException
=>
_reportTestException
;
TestExceptionReporter
_reportTestException
=
_defaultTestExceptionReporter
;
TestExceptionReporter
_reportTestException
=
_defaultTestExceptionReporter
;
set
reportTestException
(
TestExceptionReporter
handler
)
{
set
reportTestException
(
TestExceptionReporter
handler
)
{
assert
(
handler
!=
null
);
_reportTestException
=
handler
;
_reportTestException
=
handler
;
}
}
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
83720015
...
@@ -138,7 +138,6 @@ void testWidgets(
...
@@ -138,7 +138,6 @@ void testWidgets(
TestVariant
<
Object
?>
variant
=
const
DefaultTestVariant
(),
TestVariant
<
Object
?>
variant
=
const
DefaultTestVariant
(),
dynamic
tags
,
dynamic
tags
,
})
{
})
{
assert
(
variant
!=
null
);
assert
(
variant
.
values
.
isNotEmpty
,
'There must be at least one value to test in the testing variant.'
);
assert
(
variant
.
values
.
isNotEmpty
,
'There must be at least one value to test in the testing variant.'
);
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
WidgetTester
tester
=
WidgetTester
.
_
(
binding
);
final
WidgetTester
tester
=
WidgetTester
.
_
(
binding
);
...
@@ -573,7 +572,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
...
@@ -573,7 +572,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
@override
@override
Future
<
List
<
Duration
>>
handlePointerEventRecord
(
Iterable
<
PointerEventRecord
>
records
)
{
Future
<
List
<
Duration
>>
handlePointerEventRecord
(
Iterable
<
PointerEventRecord
>
records
)
{
assert
(
records
!=
null
);
assert
(
records
.
isNotEmpty
);
assert
(
records
.
isNotEmpty
);
return
TestAsyncUtils
.
guard
<
List
<
Duration
>>(()
async
{
return
TestAsyncUtils
.
guard
<
List
<
Duration
>>(()
async
{
final
List
<
Duration
>
handleTimeStampDiff
=
<
Duration
>[];
final
List
<
Duration
>
handleTimeStampDiff
=
<
Duration
>[];
...
@@ -664,9 +662,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
...
@@ -664,9 +662,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
EnginePhase
phase
=
EnginePhase
.
sendSemanticsUpdate
,
EnginePhase
phase
=
EnginePhase
.
sendSemanticsUpdate
,
Duration
timeout
=
const
Duration
(
minutes:
10
),
Duration
timeout
=
const
Duration
(
minutes:
10
),
])
{
])
{
assert
(
duration
!=
null
);
assert
(
duration
>
Duration
.
zero
);
assert
(
duration
>
Duration
.
zero
);
assert
(
timeout
!=
null
);
assert
(
timeout
>
Duration
.
zero
);
assert
(
timeout
>
Duration
.
zero
);
assert
(()
{
assert
(()
{
final
WidgetsBinding
binding
=
this
.
binding
;
final
WidgetsBinding
binding
=
this
.
binding
;
...
@@ -705,7 +701,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
...
@@ -705,7 +701,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
Duration
maxDuration
,
[
Duration
maxDuration
,
[
Duration
interval
=
const
Duration
(
milliseconds:
16
,
microseconds:
683
),
Duration
interval
=
const
Duration
(
milliseconds:
16
,
microseconds:
683
),
])
{
])
{
assert
(
maxDuration
!=
null
);
// The interval following the last frame doesn't have to be within the fullDuration.
// The interval following the last frame doesn't have to be within the fullDuration.
Duration
elapsed
=
Duration
.
zero
;
Duration
elapsed
=
Duration
.
zero
;
return
TestAsyncUtils
.
guard
<
void
>(()
async
{
return
TestAsyncUtils
.
guard
<
void
>(()
async
{
...
@@ -822,7 +817,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
...
@@ -822,7 +817,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
@override
@override
HitTestResult
hitTestOnBinding
(
Offset
location
)
{
HitTestResult
hitTestOnBinding
(
Offset
location
)
{
assert
(
location
!=
null
);
location
=
binding
.
localToGlobal
(
location
);
location
=
binding
.
localToGlobal
(
location
);
return
super
.
hitTestOnBinding
(
location
);
return
super
.
hitTestOnBinding
(
location
);
}
}
...
@@ -1003,7 +997,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
...
@@ -1003,7 +997,6 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
/// error message. It should be an adverbial phrase describing the current
/// error message. It should be an adverbial phrase describing the current
/// situation, such as "at the end of the test".
/// situation, such as "at the end of the test".
void
verifyTickersWereDisposed
([
String
when
=
'when none should have been'
])
{
void
verifyTickersWereDisposed
([
String
when
=
'when none should have been'
])
{
assert
(
when
!=
null
);
if
(
_tickers
!=
null
)
{
if
(
_tickers
!=
null
)
{
for
(
final
Ticker
ticker
in
_tickers
!)
{
for
(
final
Ticker
ticker
in
_tickers
!)
{
if
(
ticker
.
isActive
)
{
if
(
ticker
.
isActive
)
{
...
...
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