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
53b63581
Unverified
Commit
53b63581
authored
Aug 28, 2018
by
Ian Hickson
Committed by
GitHub
Aug 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-enable missing_return (#20844)
parent
458d0b3d
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
88 additions
and
59 deletions
+88
-59
analysis_options.yaml
analysis_options.yaml
+1
-2
test.dart
dev/bots/test.dart
+1
-0
microbenchmarks.dart
dev/devicelab/lib/tasks/microbenchmarks.dart
+1
-1
gen_date_localizations.dart
dev/tools/gen_date_localizations.dart
+1
-0
cupertino_navigation_demo.dart
...gallery/lib/demo/cupertino/cupertino_navigation_demo.dart
+2
-1
scrollable_tabs_demo.dart
...utter_gallery/lib/demo/material/scrollable_tabs_demo.dart
+3
-1
transitions_perf_test.dart
...es/flutter_gallery/test_driver/transitions_perf_test.dart
+1
-1
sector_test.dart
examples/layers/test/sector_test.dart
+2
-2
main_test.dart
examples/layers/test/smoketests/lib/main_test.dart
+1
-1
isolate_test.dart
examples/layers/test/smoketests/services/isolate_test.dart
+1
-1
lifecycle_test.dart
examples/layers/test/smoketests/services/lifecycle_test.dart
+1
-1
custom_render_box_test.dart
...ayers/test/smoketests/widgets/custom_render_box_test.dart
+1
-1
gestures_test.dart
examples/layers/test/smoketests/widgets/gestures_test.dart
+1
-1
hello_world_test.dart
...ples/layers/test/smoketests/widgets/hello_world_test.dart
+1
-1
media_query_test.dart
...ples/layers/test/smoketests/widgets/media_query_test.dart
+1
-1
sectors_test.dart
examples/layers/test/smoketests/widgets/sectors_test.dart
+1
-1
spinning_square_test.dart
.../layers/test/smoketests/widgets/spinning_square_test.dart
+1
-1
styled_text_test.dart
...ples/layers/test/smoketests/widgets/styled_text_test.dart
+1
-1
analysis_options_user.yaml
packages/flutter/lib/analysis_options_user.yaml
+0
-3
platform_channel.dart
packages/flutter/lib/src/services/platform_channel.dart
+6
-0
platform_views.dart
packages/flutter/lib/src/services/platform_views.dart
+2
-2
async.dart
packages/flutter/lib/src/widgets/async.dart
+4
-0
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+5
-1
tab_test.dart
packages/flutter/test/cupertino/tab_test.dart
+2
-0
debug_test.dart
packages/flutter/test/gestures/debug_test.dart
+3
-3
app_test.dart
packages/flutter/test/material/app_test.dart
+2
-0
checkbox_test.dart
packages/flutter/test/material/checkbox_test.dart
+1
-1
feedback_test.dart
packages/flutter/test/material/feedback_test.dart
+1
-1
feedback_tester.dart
packages/flutter/test/material/feedback_tester.dart
+1
-1
radio_test.dart
packages/flutter/test/material/radio_test.dart
+1
-1
refresh_indicator_test.dart
packages/flutter/test/material/refresh_indicator_test.dart
+1
-1
switch_test.dart
packages/flutter/test/material/switch_test.dart
+2
-2
tooltip_test.dart
packages/flutter/test/material/tooltip_test.dart
+1
-1
platform_messages_test.dart
packages/flutter/test/services/platform_messages_test.dart
+1
-0
dispose_ancestor_lookup_test.dart
...es/flutter/test/widgets/dispose_ancestor_lookup_test.dart
+1
-1
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+1
-1
list_wheel_scroll_view_test.dart
...ges/flutter/test/widgets/list_wheel_scroll_view_test.dart
+4
-4
navigator_test.dart
packages/flutter/test/widgets/navigator_test.dart
+1
-0
notification_test.dart
packages/flutter/test/widgets/notification_test.dart
+2
-1
page_forward_transitions_test.dart
...s/flutter/test/widgets/page_forward_transitions_test.dart
+2
-0
text_formatter_test.dart
packages/flutter/test/widgets/text_formatter_test.dart
+1
-0
flutter_driver_test.dart
packages/flutter_driver/test/flutter_driver_test.dart
+3
-3
extension_test.dart
packages/flutter_driver/test/src/extension_test.dart
+1
-1
matchers.dart
packages/flutter_test/lib/src/matchers.dart
+7
-7
widget_tester_test.dart
packages/flutter_test/test/widget_tester_test.dart
+1
-1
compile_test.dart
packages/flutter_tools/test/compile_test.dart
+1
-1
flutter_command_test.dart
packages/flutter_tools/test/runner/flutter_command_test.dart
+6
-2
utils_test.dart
packages/flutter_tools/test/utils_test.dart
+2
-2
No files found.
analysis_options.yaml
View file @
53b63581
...
...
@@ -26,9 +26,8 @@ analyzer:
errors
:
# treat missing required parameters as a warning (not a hint)
missing_required_param
:
warning
# TODO(devoncarew): https://github.com/flutter/flutter/issues/20114
# treat missing returns as a warning (not a hint)
missing_return
:
ignore
missing_return
:
warning
# allow having TODOs in the code
todo
:
ignore
exclude
:
...
...
dev/bots/test.dart
View file @
53b63581
...
...
@@ -600,6 +600,7 @@ Future<Null> _verifyNoTestPackageImports(String workingDirectory) async {
}
return
'
$name
: uses
\'
package:test
\'
directly'
;
}
return
null
;
})
.
where
((
String
line
)
=>
line
!=
null
)
.
toList
()
...
...
dev/devicelab/lib/tasks/microbenchmarks.dart
View file @
53b63581
...
...
@@ -141,7 +141,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
jsonBuf
.
writeln
(
line
.
substring
(
line
.
indexOf
(
jsonPrefix
)
+
jsonPrefix
.
length
));
});
process
.
exitCode
.
then
<
int
>((
int
code
)
async
{
process
.
exitCode
.
then
<
void
>((
int
code
)
async
{
await
Future
.
wait
<
void
>(<
Future
<
void
>>[
stdoutSub
.
cancel
(),
stderrSub
.
cancel
(),
...
...
dev/tools/gen_date_localizations.dart
View file @
53b63581
...
...
@@ -58,6 +58,7 @@ Future<Null> main(List<String> rawArgs) async {
(
String
line
)
=>
line
.
startsWith
(
'intl:'
),
orElse:
()
{
exitWithError
(
'intl dependency not found in
${dotPackagesFile.path}
'
);
return
null
;
// unreachable
},
)
.
split
(
':'
)
...
...
examples/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart
View file @
53b63581
...
...
@@ -71,6 +71,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
],
),
tabBuilder:
(
BuildContext
context
,
int
index
)
{
assert
(
index
>=
0
&&
index
<=
2
);
switch
(
index
)
{
case
0
:
return
new
CupertinoTabView
(
...
...
@@ -95,8 +96,8 @@ class CupertinoNavigationDemo extends StatelessWidget {
defaultTitle:
'Account'
,
);
break
;
default
:
}
return
null
;
},
),
),
...
...
examples/flutter_gallery/lib/demo/material/scrollable_tabs_demo.dart
View file @
53b63581
...
...
@@ -155,7 +155,8 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
controller:
_controller
,
isScrollable:
true
,
indicator:
getIndicator
(),
tabs:
_allPages
.
map
((
_Page
page
)
{
tabs:
_allPages
.
map
<
Tab
>((
_Page
page
)
{
assert
(
_demoStyle
!=
null
);
switch
(
_demoStyle
)
{
case
TabsDemoStyle
.
iconsAndText
:
return
new
Tab
(
text:
page
.
text
,
icon:
new
Icon
(
page
.
icon
));
...
...
@@ -164,6 +165,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
case
TabsDemoStyle
.
textOnly
:
return
new
Tab
(
text:
page
.
text
);
}
return
null
;
}).
toList
(),
),
),
...
...
examples/flutter_gallery/test_driver/transitions_perf_test.dart
View file @
53b63581
...
...
@@ -156,7 +156,7 @@ Future<Null> runDemos(List<String> demos, FlutterDriver driver) async {
await
driver
.
tap
(
demoItem
);
// Launch the demo
if
(
kUnsynchronizedDemos
.
contains
(
demo
))
{
await
driver
.
runUnsynchronized
<
Future
<
Null
>
>(()
async
{
await
driver
.
runUnsynchronized
<
void
>(()
async
{
await
driver
.
tap
(
find
.
byTooltip
(
'Back'
));
});
}
else
{
...
...
examples/layers/test/sector_test.dart
View file @
53b63581
...
...
@@ -12,7 +12,7 @@ void main() {
expect
(
const
SectorConstraints
().
isTight
,
isFalse
);
});
testWidgets
(
'Sector Sixes'
,
(
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
SectorApp
());
testWidgets
(
'Sector Sixes'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
SectorApp
());
});
}
examples/layers/test/smoketests/lib/main_test.dart
View file @
53b63581
...
...
@@ -6,7 +6,7 @@ import 'package:flutter_examples_layers/main.dart' as demo;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'layers smoketest for lib/main.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for lib/main.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/services/isolate_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../services/isolate.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for services/isolate.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for services/isolate.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/services/lifecycle_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../services/lifecycle.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for services/lifecycle.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for services/lifecycle.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/widgets/custom_render_box_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../widgets/custom_render_box.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for widgets/custom_render_box.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for widgets/custom_render_box.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/widgets/gestures_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../widgets/gestures.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for widgets/gestures.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for widgets/gestures.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/widgets/hello_world_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../widgets/hello_world.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for widgets/hello_world.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for widgets/hello_world.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/widgets/media_query_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../widgets/media_query.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for widgets/media_query.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for widgets/media_query.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/widgets/sectors_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../widgets/sectors.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for widgets/sectors.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for widgets/sectors.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/widgets/spinning_square_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../widgets/spinning_square.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for widgets/spinning_square.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for widgets/spinning_square.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
examples/layers/test/smoketests/widgets/styled_text_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import
'../../../widgets/styled_text.dart'
as
demo
;
void
main
(
)
{
testWidgets
(
'layers smoketest for widgets/styled_text.dart'
,
(
WidgetTester
tester
)
{
testWidgets
(
'layers smoketest for widgets/styled_text.dart'
,
(
WidgetTester
tester
)
async
{
demo
.
main
();
});
}
packages/flutter/lib/analysis_options_user.yaml
View file @
53b63581
...
...
@@ -26,9 +26,6 @@ analyzer:
errors
:
# treat missing required parameters as a warning (not a hint)
missing_required_param
:
warning
# treat missing returns as a warning (not a hint)
# TODO(ianh): https://github.com/flutter/flutter/issues/20114
missing_return
:
ignore
# allow having TODOs in the code
todo
:
ignore
...
...
packages/flutter/lib/src/services/platform_channel.dart
View file @
53b63581
...
...
@@ -313,6 +313,11 @@ class MethodChannel {
///
/// This is intended for testing. Method calls intercepted in this manner are
/// not sent to platform plugins.
///
/// The provided `handler` must return a `Future` that completes with the
/// return value of the call. The value will be encoded using
/// [MethodCodec.encodeSuccessEnvelope], to act as if platform plugin had
/// returned that value.
void
setMockMethodCallHandler
(
Future
<
dynamic
>
handler
(
MethodCall
call
))
{
BinaryMessages
.
setMockMessageHandler
(
name
,
...
...
@@ -413,6 +418,7 @@ class EventChannel {
controller
.
addError
(
e
);
}
}
return
null
;
});
try
{
await
methodChannel
.
invokeMethod
(
'listen'
,
arguments
);
...
...
packages/flutter/lib/src/services/platform_views.dart
View file @
53b63581
...
...
@@ -494,14 +494,14 @@ class AndroidViewController {
}
static
int
_getAndroidDirection
(
TextDirection
direction
)
{
assert
(
direction
!=
null
);
switch
(
direction
)
{
case
TextDirection
.
ltr
:
return
kAndroidLayoutDirectionLtr
;
case
TextDirection
.
rtl
:
return
kAndroidLayoutDirectionRtl
;
default
:
throw
new
UnsupportedError
(
'Direction
$direction
is not supported'
);
}
return
null
;
}
/// Sends an Android [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)
...
...
packages/flutter/lib/src/widgets/async.dart
View file @
53b63581
...
...
@@ -359,9 +359,11 @@ typedef Widget AsyncWidgetBuilder<T>(BuildContext context, AsyncSnapshot<T> snap
/// case ConnectionState.active: return new Text('\$${snapshot.data}');
/// case ConnectionState.done: return new Text('\$${snapshot.data} (closed)');
/// }
/// return null; // unreachable
/// },
/// )
/// ```
// TODO(ianh): remove unreachable code above once https://github.com/dart-lang/linter/issues/1141 is fixed
class
StreamBuilder
<
T
>
extends
StreamBuilderBase
<
T
,
AsyncSnapshot
<
T
>>
{
/// Creates a new [StreamBuilder] that builds itself based on the latest
/// snapshot of interaction with the specified [stream] and whose build
...
...
@@ -491,9 +493,11 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
/// return new Text('Error: ${snapshot.error}');
/// return new Text('Result: ${snapshot.data}');
/// }
/// return null; // unreachable
/// },
/// )
/// ```
// TODO(ianh): remove unreachable code above once https://github.com/dart-lang/linter/issues/1141 is fixed
class
FutureBuilder
<
T
>
extends
StatefulWidget
{
/// Creates a widget that builds itself based on the latest snapshot of
/// interaction with a [Future].
...
...
packages/flutter/lib/src/widgets/heroes.dart
View file @
53b63581
...
...
@@ -321,12 +321,16 @@ class _HeroFlight {
assert
(!
_aborted
);
assert
(()
{
final
Animation
<
double
>
initial
=
initialManifest
.
animation
;
switch
(
initialManifest
.
type
)
{
assert
(
initial
!=
null
);
final
_HeroFlightType
type
=
initialManifest
.
type
;
assert
(
type
!=
null
);
switch
(
type
)
{
case
_HeroFlightType
.
pop
:
return
initial
.
value
==
1.0
&&
initial
.
status
==
AnimationStatus
.
reverse
;
case
_HeroFlightType
.
push
:
return
initial
.
value
==
0.0
&&
initial
.
status
==
AnimationStatus
.
forward
;
}
return
null
;
}());
manifest
=
initialManifest
;
...
...
packages/flutter/test/cupertino/tab_test.dart
View file @
53b63581
...
...
@@ -71,6 +71,7 @@ void main() {
}
);
}
return
null
;
},
),
),
...
...
@@ -86,6 +87,7 @@ void main() {
home:
new
CupertinoTabView
(
onUnknownRoute:
(
RouteSettings
settings
)
{
unknownForRouteCalled
=
settings
.
name
;
return
null
;
},
),
),
...
...
packages/flutter/test/gestures/debug_test.dart
View file @
53b63581
...
...
@@ -7,7 +7,7 @@ import 'package:flutter/gestures.dart';
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'debugPrintGestureArenaDiagnostics'
,
(
WidgetTester
tester
)
{
testWidgets
(
'debugPrintGestureArenaDiagnostics'
,
(
WidgetTester
tester
)
async
{
PointerEvent
event
;
debugPrintGestureArenaDiagnostics
=
true
;
final
DebugPrintCallback
oldCallback
=
debugPrint
;
...
...
@@ -53,7 +53,7 @@ void main() {
debugPrint
=
oldCallback
;
});
testWidgets
(
'debugPrintRecognizerCallbacksTrace'
,
(
WidgetTester
tester
)
{
testWidgets
(
'debugPrintRecognizerCallbacksTrace'
,
(
WidgetTester
tester
)
async
{
PointerEvent
event
;
debugPrintRecognizerCallbacksTrace
=
true
;
final
DebugPrintCallback
oldCallback
=
debugPrint
;
...
...
@@ -95,7 +95,7 @@ void main() {
debugPrint
=
oldCallback
;
});
testWidgets
(
'debugPrintGestureArenaDiagnostics and debugPrintRecognizerCallbacksTrace'
,
(
WidgetTester
tester
)
{
testWidgets
(
'debugPrintGestureArenaDiagnostics and debugPrintRecognizerCallbacksTrace'
,
(
WidgetTester
tester
)
async
{
PointerEvent
event
;
debugPrintGestureArenaDiagnostics
=
true
;
debugPrintRecognizerCallbacksTrace
=
true
;
...
...
packages/flutter/test/material/app_test.dart
View file @
53b63581
...
...
@@ -368,9 +368,11 @@ void main() {
new
MaterialApp
(
onGenerateRoute:
(
RouteSettings
settings
)
{
log
.
add
(
'onGenerateRoute
${settings.name}
'
);
return
null
;
},
onUnknownRoute:
(
RouteSettings
settings
)
{
log
.
add
(
'onUnknownRoute
${settings.name}
'
);
return
null
;
},
)
);
...
...
packages/flutter/test/material/checkbox_test.dart
View file @
53b63581
...
...
@@ -250,7 +250,7 @@ void main() {
testWidgets
(
'has semantic events'
,
(
WidgetTester
tester
)
async
{
dynamic
semanticEvent
;
bool
checkboxValue
=
false
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
async
{
semanticEvent
=
message
;
});
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
...
...
packages/flutter/test/material/feedback_test.dart
View file @
53b63581
...
...
@@ -29,7 +29,7 @@ void main () {
setUp
(()
{
semanticEvents
=
<
Map
<
String
,
Object
>>[];
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
async
{
final
Map
<
dynamic
,
dynamic
>
typedMessage
=
message
;
semanticEvents
.
add
(
typedMessage
.
cast
<
String
,
Object
>());
});
...
...
packages/flutter/test/material/feedback_tester.dart
View file @
53b63581
...
...
@@ -10,7 +10,7 @@ import 'package:flutter/services.dart';
/// cannot be used in combination with other classes that do the same.
class
FeedbackTester
{
FeedbackTester
()
{
SystemChannels
.
platform
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
{
SystemChannels
.
platform
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
if
(
methodCall
.
method
==
'HapticFeedback.vibrate'
)
_hapticCount
++;
if
(
methodCall
.
method
==
'SystemSound.play'
&&
...
...
packages/flutter/test/material/radio_test.dart
View file @
53b63581
...
...
@@ -216,7 +216,7 @@ void main() {
final
Key
key
=
new
UniqueKey
();
dynamic
semanticEvent
;
int
radioValue
=
2
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
async
{
semanticEvent
=
message
;
});
...
...
packages/flutter/test/material/refresh_indicator_test.dart
View file @
53b63581
...
...
@@ -358,7 +358,7 @@ void main() {
home:
new
RefreshIndicator
(
onRefresh:
()
{
refreshCalled
=
true
;
// Missing a returned Future value here
.
return
null
;
// Missing a returned Future value here, should cause framework to throw
.
},
child:
new
ListView
(
physics:
const
AlwaysScrollableScrollPhysics
(),
...
...
packages/flutter/test/material/switch_test.dart
View file @
53b63581
...
...
@@ -274,7 +274,7 @@ void main() {
testWidgets
(
'switch has semantic events'
,
(
WidgetTester
tester
)
async
{
dynamic
semanticEvent
;
bool
value
=
false
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
async
{
semanticEvent
=
message
;
});
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
...
...
@@ -318,7 +318,7 @@ void main() {
testWidgets
(
'switch sends semantic events from parent if fully merged'
,
(
WidgetTester
tester
)
async
{
dynamic
semanticEvent
;
bool
value
=
false
;
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
async
{
semanticEvent
=
message
;
});
final
SemanticsTester
semanticsTester
=
new
SemanticsTester
(
tester
);
...
...
packages/flutter/test/material/tooltip_test.dart
View file @
53b63581
...
...
@@ -679,7 +679,7 @@ void main() {
testWidgets
(
'has semantic events'
,
(
WidgetTester
tester
)
async
{
final
List
<
dynamic
>
semanticEvents
=
<
dynamic
>[];
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
{
SystemChannels
.
accessibility
.
setMockMessageHandler
((
dynamic
message
)
async
{
semanticEvents
.
add
(
message
);
});
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
...
...
packages/flutter/test/services/platform_messages_test.dart
View file @
53b63581
...
...
@@ -13,6 +13,7 @@ void main() {
BinaryMessages
.
setMockMessageHandler
(
'test1'
,
(
ByteData
message
)
async
{
log
.
add
(
message
);
return
null
;
});
final
ByteData
message
=
new
ByteData
(
2
)..
setUint16
(
0
,
0xABCD
);
...
...
packages/flutter/test/widgets/dispose_ancestor_lookup_test.dart
View file @
53b63581
...
...
@@ -98,7 +98,7 @@ void main() {
await
tester
.
pumpWidget
(
new
TestWidget
((
BuildContext
context
)
{
disposeCalled
=
true
;
context
.
visitAncestorElements
((
Element
element
)
{
}
);
context
.
visitAncestorElements
((
Element
element
)
=>
true
);
}),
);
await
tester
.
pumpWidget
(
new
Container
());
...
...
packages/flutter/test/widgets/editable_text_test.dart
View file @
53b63581
...
...
@@ -788,7 +788,7 @@ void main() {
// Verify TextInput.setEditingState is fired with updated text when controller is replaced.
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
SystemChannels
.
textInput
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
{
SystemChannels
.
textInput
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
});
setState
(()
{
...
...
packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
View file @
53b63581
...
...
@@ -1027,9 +1027,9 @@ void main() {
textDirection:
TextDirection
.
ltr
,
child:
new
NotificationListener
<
ScrollNotification
>(
onNotification:
(
ScrollNotification
notification
)
{
if
(
notification
is
ScrollUpdateNotification
)
{
if
(
notification
is
ScrollUpdateNotification
)
scrolledPositions
.
add
(
notification
.
metrics
.
pixels
);
}
return
false
;
},
child:
new
ListWheelScrollView
(
controller:
controller
,
...
...
@@ -1078,9 +1078,9 @@ void main() {
textDirection:
TextDirection
.
ltr
,
child:
new
NotificationListener
<
ScrollNotification
>(
onNotification:
(
ScrollNotification
notification
)
{
if
(
notification
is
ScrollUpdateNotification
)
{
if
(
notification
is
ScrollUpdateNotification
)
scrolledPositions
.
add
(
notification
.
metrics
.
pixels
);
}
return
false
;
},
child:
new
ListWheelScrollView
(
controller:
controller
,
...
...
packages/flutter/test/widgets/navigator_test.dart
View file @
53b63581
...
...
@@ -232,6 +232,7 @@ void main() {
},
);
}
return
null
;
},
),
),
...
...
packages/flutter/test/widgets/notification_test.dart
View file @
53b63581
...
...
@@ -66,9 +66,10 @@ void main() {
await
tester
.
pumpWidget
(
new
NotificationListener
<
MyNotification
>(
onNotification:
(
MyNotification
value
)
{
log
.
add
(
value
.
runtimeType
);
return
false
;
},
child:
new
NotificationListener
<
MyNotification
>(
onNotification:
(
MyNotification
value
)
{
}
,
onNotification:
(
MyNotification
value
)
=>
false
,
child:
new
Container
(
key:
key
),
),
));
...
...
packages/flutter/test/widgets/page_forward_transitions_test.dart
View file @
53b63581
...
...
@@ -108,6 +108,7 @@ void main() {
case
'/3'
:
return
new
TestRoute
<
Null
>(
settings:
settings
,
child:
const
Text
(
'F'
));
case
'/4'
:
return
new
TestRoute
<
Null
>(
settings:
settings
,
child:
const
Text
(
'G'
));
}
return
null
;
}
)
);
...
...
@@ -192,6 +193,7 @@ void main() {
case
'/'
:
return
new
TestRoute
<
Null
>(
settings:
settings
,
child:
const
Text
(
'A'
));
case
'/1'
:
return
new
TestRoute
<
Null
>(
settings:
settings
,
barrierColor:
const
Color
(
0xFFFFFF00
),
child:
const
Text
(
'B'
));
}
return
null
;
}
)
);
...
...
packages/flutter/test/widgets/text_formatter_test.dart
View file @
53b63581
...
...
@@ -21,6 +21,7 @@ void main() {
(
TextEditingValue
oldValue
,
TextEditingValue
newValue
)
{
calledOldValue
=
oldValue
;
calledNewValue
=
newValue
;
return
null
;
}
);
...
...
packages/flutter_driver/test/flutter_driver_test.dart
View file @
53b63581
...
...
@@ -281,7 +281,7 @@ void main() {
});
test
(
'without clearing timeline'
,
()
async
{
final
Timeline
timeline
=
await
driver
.
traceAction
(()
{
final
Timeline
timeline
=
await
driver
.
traceAction
(()
async
{
log
.
add
(
'action'
);
},
retainPriorEvents:
true
);
...
...
@@ -295,7 +295,7 @@ void main() {
});
test
(
'with clearing timeline'
,
()
async
{
final
Timeline
timeline
=
await
driver
.
traceAction
(()
{
final
Timeline
timeline
=
await
driver
.
traceAction
(()
async
{
log
.
add
(
'action'
);
});
...
...
@@ -338,7 +338,7 @@ void main() {
};
});
final
Timeline
timeline
=
await
driver
.
traceAction
(()
{
final
Timeline
timeline
=
await
driver
.
traceAction
(()
async
{
actionCalled
=
true
;
},
streams:
const
<
TimelineStream
>[
...
...
packages/flutter_driver/test/src/extension_test.dart
View file @
53b63581
...
...
@@ -74,7 +74,7 @@ void main() {
group
(
'getSemanticsId'
,
()
{
FlutterDriverExtension
extension
;
setUp
(()
{
extension
=
new
FlutterDriverExtension
((
String
arg
)
async
{}
,
true
);
extension
=
new
FlutterDriverExtension
((
String
arg
)
async
=>
''
,
true
);
});
testWidgets
(
'works when semantics are enabled'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter_test/lib/src/matchers.dart
View file @
53b63581
...
...
@@ -1531,13 +1531,13 @@ class _MatchesGoldenFile extends AsyncMatcher {
return
'Failed to generate screenshot from engine within the 10,000ms timeout.'
;
if
(
autoUpdateGoldenFiles
)
{
await
goldenFileComparator
.
update
(
key
,
bytes
.
buffer
.
asUint8List
());
}
else
{
try
{
final
bool
success
=
await
goldenFileComparator
.
compare
(
bytes
.
buffer
.
asUint8List
(),
key
);
return
success
?
null
:
'does not match'
;
}
on
TestFailure
catch
(
ex
)
{
return
ex
.
message
;
}
return
null
;
}
try
{
final
bool
success
=
await
goldenFileComparator
.
compare
(
bytes
.
buffer
.
asUint8List
(),
key
)
;
return
success
?
null
:
'does not match'
;
}
on
TestFailure
catch
(
ex
)
{
return
ex
.
message
;
}
},
additionalTime:
const
Duration
(
seconds:
11
));
}
...
...
packages/flutter_test/test/widget_tester_test.dart
View file @
53b63581
...
...
@@ -500,7 +500,7 @@ void main() {
final
Object
key
=
new
Object
();
await
runZoned
(()
{
expect
(
Zone
.
current
[
key
],
'abczed'
);
return
tester
.
runAsync
<
String
>(()
async
{
return
tester
.
runAsync
<
void
>(()
async
{
expect
(
Zone
.
current
[
key
],
'abczed'
);
});
},
zoneValues:
<
dynamic
,
dynamic
>{
...
...
packages/flutter_tools/test/compile_test.dart
View file @
53b63581
...
...
@@ -369,7 +369,7 @@ Future<Null> _recompile(StreamController<List<int>> streamController,
String
mockCompilerOutput
)
async
{
// Put content into the output stream after generator.recompile gets
// going few lines below, resets completer.
new
Future
<
List
<
int
>>
(()
{
scheduleMicrotask
(()
{
streamController
.
add
(
utf8
.
encode
(
mockCompilerOutput
));
});
final
CompilerOutput
output
=
await
generator
.
recompile
(
null
/* mainPath */
,
<
String
>[
'/path/to/main.dart'
]);
...
...
packages/flutter_tools/test/runner/flutter_command_test.dart
View file @
53b63581
...
...
@@ -125,8 +125,12 @@ void main() {
// Crash if called a third time which is unexpected.
mockTimes
=
<
int
>[
1000
,
2000
];
final
DummyFlutterCommand
flutterCommand
=
new
DummyFlutterCommand
(
commandFunction:
()
async
{
throwToolExit
(
'fail'
);
});
final
DummyFlutterCommand
flutterCommand
=
new
DummyFlutterCommand
(
commandFunction:
()
async
{
throwToolExit
(
'fail'
);
return
null
;
// unreachable
},
);
try
{
await
flutterCommand
.
run
();
...
...
packages/flutter_tools/test/utils_test.dart
View file @
53b63581
...
...
@@ -130,7 +130,7 @@ baz=qux
test
(
'fires at start'
,
()
async
{
bool
called
=
false
;
poller
=
new
Poller
(()
{
poller
=
new
Poller
(()
async
{
called
=
true
;
},
const
Duration
(
seconds:
1
));
expect
(
called
,
false
);
...
...
@@ -141,7 +141,7 @@ baz=qux
test
(
'runs periodically'
,
()
async
{
// Ensure we get the first (no-delay) callback, and one of the periodic callbacks.
int
callCount
=
0
;
poller
=
new
Poller
(()
{
poller
=
new
Poller
(()
async
{
callCount
++;
},
new
Duration
(
milliseconds:
kShortDelay
.
inMilliseconds
~/
2
));
expect
(
callCount
,
0
);
...
...
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