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
580c844c
Unverified
Commit
580c844c
authored
May 16, 2018
by
Hans Muller
Committed by
GitHub
May 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added GalleryApp testMode (#17640)
parent
0cbda7d6
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
104 additions
and
67 deletions
+104
-67
app.dart
examples/flutter_gallery/lib/gallery/app.dart
+3
-0
backdrop.dart
examples/flutter_gallery/lib/gallery/backdrop.dart
+63
-52
home.dart
examples/flutter_gallery/lib/gallery/home.dart
+4
-2
drawer_test.dart
examples/flutter_gallery/test/drawer_test.dart
+1
-0
example_code_display_test.dart
examples/flutter_gallery/test/example_code_display_test.dart
+1
-1
live_smoketest.dart
examples/flutter_gallery/test/live_smoketest.dart
+1
-1
pesto_test.dart
examples/flutter_gallery/test/pesto_test.dart
+2
-2
simple_smoke_test.dart
examples/flutter_gallery/test/simple_smoke_test.dart
+4
-2
smoke_test.dart
examples/flutter_gallery/test/smoke_test.dart
+1
-0
update_test.dart
examples/flutter_gallery/test/update_test.dart
+6
-1
memory_nav.dart
examples/flutter_gallery/test_driver/memory_nav.dart
+6
-2
scroll_perf.dart
examples/flutter_gallery/test_driver/scroll_perf.dart
+6
-2
transitions_perf.dart
examples/flutter_gallery/test_driver/transitions_perf.dart
+6
-2
No files found.
examples/flutter_gallery/lib/gallery/app.dart
View file @
580c844c
...
@@ -25,6 +25,7 @@ class GalleryApp extends StatefulWidget {
...
@@ -25,6 +25,7 @@ class GalleryApp extends StatefulWidget {
this
.
enableRasterCacheImagesCheckerboard
:
true
,
this
.
enableRasterCacheImagesCheckerboard
:
true
,
this
.
enableOffscreenLayersCheckerboard
:
true
,
this
.
enableOffscreenLayersCheckerboard
:
true
,
this
.
onSendFeedback
,
this
.
onSendFeedback
,
this
.
testMode
:
false
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
final
UpdateUrlFetcher
updateUrlFetcher
;
final
UpdateUrlFetcher
updateUrlFetcher
;
...
@@ -32,6 +33,7 @@ class GalleryApp extends StatefulWidget {
...
@@ -32,6 +33,7 @@ class GalleryApp extends StatefulWidget {
final
bool
enableRasterCacheImagesCheckerboard
;
final
bool
enableRasterCacheImagesCheckerboard
;
final
bool
enableOffscreenLayersCheckerboard
;
final
bool
enableOffscreenLayersCheckerboard
;
final
VoidCallback
onSendFeedback
;
final
VoidCallback
onSendFeedback
;
final
bool
testMode
;
@override
@override
_GalleryAppState
createState
()
=>
new
_GalleryAppState
();
_GalleryAppState
createState
()
=>
new
_GalleryAppState
();
...
@@ -107,6 +109,7 @@ class _GalleryAppState extends State<GalleryApp> {
...
@@ -107,6 +109,7 @@ class _GalleryAppState extends State<GalleryApp> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
Widget
home
=
new
GalleryHome
(
Widget
home
=
new
GalleryHome
(
testMode:
widget
.
testMode
,
optionsPage:
new
GalleryOptionsPage
(
optionsPage:
new
GalleryOptionsPage
(
options:
_options
,
options:
_options
,
onOptionsChanged:
_handleOptionsChanged
,
onOptionsChanged:
_handleOptionsChanged
,
...
...
examples/flutter_gallery/lib/gallery/backdrop.dart
View file @
580c844c
...
@@ -263,66 +263,72 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
...
@@ -263,66 +263,72 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
end:
const
RelativeRect
.
fromLTRB
(
0.0
,
_kBackAppBarHeight
,
0.0
,
0.0
),
end:
const
RelativeRect
.
fromLTRB
(
0.0
,
_kBackAppBarHeight
,
0.0
,
0.0
),
).
animate
(
_controller
);
).
animate
(
_controller
);
return
new
Stack
(
final
List
<
Widget
>
layers
=
<
Widget
>[
key:
_backdropKey
,
// Back layer
children:
<
Widget
>[
new
Column
(
new
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
children:
<
Widget
>[
new
_BackAppBar
(
// Back layer
leading:
widget
.
frontAction
,
new
_BackAppBar
(
title:
new
_CrossFadeTransition
(
leading:
widget
.
frontAction
,
progress:
_controller
,
title:
new
_CrossFadeTransition
(
alignment:
AlignmentDirectional
.
centerStart
,
progress:
_controller
,
child0:
new
Semantics
(
namesRoute:
true
,
child:
widget
.
frontTitle
),
alignment:
AlignmentDirectional
.
centerStart
,
child1:
new
Semantics
(
namesRoute:
true
,
child:
widget
.
backTitle
),
child0:
new
Semantics
(
namesRoute:
true
,
child:
widget
.
frontTitle
),
child1:
new
Semantics
(
namesRoute:
true
,
child:
widget
.
backTitle
),
),
trailing:
new
IconButton
(
onPressed:
_toggleFrontLayer
,
tooltip:
'Toggle options page'
,
icon:
new
AnimatedIcon
(
icon:
AnimatedIcons
.
close_menu
,
progress:
_controller
,
),
),
),
),
new
Expanded
(
trailing:
new
IconButton
(
child:
new
_TappableWhileStatusIs
(
onPressed:
_toggleFrontLayer
,
AnimationStatus
.
dismissed
,
tooltip:
'Toggle options page'
,
controller:
_controller
,
icon:
new
AnimatedIcon
(
child:
widget
.
backLayer
,
icon:
AnimatedIcons
.
close_menu
,
progress:
_controller
,
),
),
),
),
],
),
),
new
Expanded
(
// Front layer
new
PositionedTransition
(
rect:
frontRelativeRect
,
child:
new
AnimatedBuilder
(
animation:
_controller
,
builder:
(
BuildContext
context
,
Widget
child
)
{
return
new
PhysicalShape
(
elevation:
12.0
,
color:
Theme
.
of
(
context
).
canvasColor
,
clipper:
new
ShapeBorderClipper
(
shape:
new
BeveledRectangleBorder
(
borderRadius:
_kFrontHeadingBevelRadius
.
lerp
(
_controller
.
value
),
),
),
child:
child
,
);
},
child:
new
_TappableWhileStatusIs
(
child:
new
_TappableWhileStatusIs
(
AnimationStatus
.
complet
ed
,
AnimationStatus
.
dismiss
ed
,
controller:
_controller
,
controller:
_controller
,
child:
new
FadeTransition
(
child:
widget
.
backLayer
,
opacity:
_frontOpacity
,
),
child:
widget
.
frontLayer
,
),
],
),
// Front layer
new
PositionedTransition
(
rect:
frontRelativeRect
,
child:
new
AnimatedBuilder
(
animation:
_controller
,
builder:
(
BuildContext
context
,
Widget
child
)
{
return
new
PhysicalShape
(
elevation:
12.0
,
color:
Theme
.
of
(
context
).
canvasColor
,
clipper:
new
ShapeBorderClipper
(
shape:
new
BeveledRectangleBorder
(
borderRadius:
_kFrontHeadingBevelRadius
.
lerp
(
_controller
.
value
),
),
),
),
child:
child
,
);
},
child:
new
_TappableWhileStatusIs
(
AnimationStatus
.
completed
,
controller:
_controller
,
child:
new
FadeTransition
(
opacity:
_frontOpacity
,
child:
widget
.
frontLayer
,
),
),
),
),
),
),
),
];
// The front "heading" is a (typically transparent) widget that's stacked on
// top of, and at the top of, the front layer. It adds support for dragging
// the front layer up and down and for opening and closing the front layer
// with a tap. It may obscure part of the front layer's topmost child.
if
(
widget
.
frontHeading
!=
null
)
{
layers
.
add
(
new
PositionedTransition
(
new
PositionedTransition
(
rect:
frontRelativeRect
,
rect:
frontRelativeRect
,
child:
new
ExcludeSemantics
(
child:
new
ExcludeSemantics
(
...
@@ -338,7 +344,12 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
...
@@ -338,7 +344,12 @@ class _BackdropState extends State<Backdrop> with SingleTickerProviderStateMixin
),
),
),
),
),
),
],
);
}
return
new
Stack
(
key:
_backdropKey
,
children:
layers
,
);
);
}
}
...
...
examples/flutter_gallery/lib/gallery/home.dart
View file @
580c844c
...
@@ -270,10 +270,12 @@ class GalleryHome extends StatefulWidget {
...
@@ -270,10 +270,12 @@ class GalleryHome extends StatefulWidget {
const
GalleryHome
({
const
GalleryHome
({
Key
key
,
Key
key
,
this
.
testMode
:
false
,
this
.
optionsPage
,
this
.
optionsPage
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
final
Widget
optionsPage
;
final
Widget
optionsPage
;
final
bool
testMode
;
@override
@override
_GalleryHomeState
createState
()
=>
new
_GalleryHomeState
();
_GalleryHomeState
createState
()
=>
new
_GalleryHomeState
();
...
@@ -345,13 +347,13 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
...
@@ -345,13 +347,13 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
onPressed:
()
=>
setState
(()
=>
_category
=
null
),
onPressed:
()
=>
setState
(()
=>
_category
=
null
),
),
),
),
),
frontTitle:
new
AnimatedSwitcher
(
frontTitle:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
duration:
_kFrontLayerSwitchDuration
,
child:
_category
==
null
child:
_category
==
null
?
const
Text
(
'Flutter gallery'
)
?
const
Text
(
'Flutter gallery'
)
:
new
Text
(
_category
.
name
),
:
new
Text
(
_category
.
name
),
),
),
frontHeading:
new
Container
(
height:
24.0
),
frontHeading:
widget
.
testMode
?
null
:
new
Container
(
height:
24.0
),
frontLayer:
new
AnimatedSwitcher
(
frontLayer:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
duration:
_kFrontLayerSwitchDuration
,
switchOutCurve:
switchOutCurve
,
switchOutCurve:
switchOutCurve
,
...
...
examples/flutter_gallery/test/drawer_test.dart
View file @
580c844c
...
@@ -17,6 +17,7 @@ void main() {
...
@@ -17,6 +17,7 @@ void main() {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
new
GalleryApp
(
new
GalleryApp
(
testMode:
true
,
onSendFeedback:
()
{
onSendFeedback:
()
{
hasFeedback
=
true
;
hasFeedback
=
true
;
},
},
...
...
examples/flutter_gallery/test/example_code_display_test.dart
View file @
580c844c
...
@@ -14,7 +14,7 @@ void main() {
...
@@ -14,7 +14,7 @@ void main() {
testWidgets
(
'Flutter gallery button example code displays'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Flutter gallery button example code displays'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/6147
// Regression test for https://github.com/flutter/flutter/issues/6147
await
tester
.
pumpWidget
(
const
GalleryApp
());
await
tester
.
pumpWidget
(
const
GalleryApp
(
testMode:
true
));
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// triggers a frame
await
tester
.
pump
();
// triggers a frame
...
...
examples/flutter_gallery/test/live_smoketest.dart
View file @
580c844c
...
@@ -43,7 +43,7 @@ Future<Null> main() async {
...
@@ -43,7 +43,7 @@ Future<Null> main() async {
if
(!
new
Set
<
String
>.
from
(
allDemoTitles
).
containsAll
(
_kSkippedDemoTitles
))
if
(!
new
Set
<
String
>.
from
(
allDemoTitles
).
containsAll
(
_kSkippedDemoTitles
))
fail
(
'Unrecognized demo names in _kSkippedDemoTitles:
$_kSkippedDemoTitles
'
);
fail
(
'Unrecognized demo names in _kSkippedDemoTitles:
$_kSkippedDemoTitles
'
);
runApp
(
const
GalleryApp
());
runApp
(
const
GalleryApp
(
testMode:
true
));
final
_LiveWidgetController
controller
=
new
_LiveWidgetController
();
final
_LiveWidgetController
controller
=
new
_LiveWidgetController
();
for
(
GalleryDemoCategory
category
in
kAllGalleryDemoCategories
)
{
for
(
GalleryDemoCategory
category
in
kAllGalleryDemoCategories
)
{
await
controller
.
tap
(
find
.
text
(
category
.
name
));
await
controller
.
tap
(
find
.
text
(
category
.
name
));
...
...
examples/flutter_gallery/test/pesto_test.dart
View file @
580c844c
...
@@ -19,7 +19,7 @@ void main() {
...
@@ -19,7 +19,7 @@ void main() {
child:
const
SizedBox
(
child:
const
SizedBox
(
width:
450.0
,
width:
450.0
,
height:
800.0
,
height:
800.0
,
child:
const
GalleryApp
()
child:
const
GalleryApp
(
testMode:
true
)
)
)
)
)
);
);
...
@@ -43,7 +43,7 @@ void main() {
...
@@ -43,7 +43,7 @@ void main() {
});
});
testWidgets
(
'Pesto can be scrolled all the way down'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Pesto can be scrolled all the way down'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
GalleryApp
());
await
tester
.
pumpWidget
(
const
GalleryApp
(
testMode:
true
));
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// triggers a frame
await
tester
.
pump
();
// triggers a frame
...
...
examples/flutter_gallery/test/simple_smoke_test.dart
View file @
580c844c
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_gallery/
main.dart'
as
flutter_gallery_main
;
import
'package:flutter_gallery/
gallery/app.dart'
show
GalleryApp
;
void
main
(
)
{
void
main
(
)
{
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
...
@@ -12,7 +12,9 @@ void main() {
...
@@ -12,7 +12,9 @@ void main() {
binding
.
framePolicy
=
LiveTestWidgetsFlutterBindingFramePolicy
.
fullyLive
;
binding
.
framePolicy
=
LiveTestWidgetsFlutterBindingFramePolicy
.
fullyLive
;
testWidgets
(
'Flutter Gallery app simple smoke test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Flutter Gallery app simple smoke test'
,
(
WidgetTester
tester
)
async
{
flutter_gallery_main
.
main
();
// builds the app and schedules a frame but doesn't trigger one
await
tester
.
pumpWidget
(
const
GalleryApp
(
testMode:
true
)
// builds the app and schedules a frame but doesn't trigger one
);
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// triggers a frame
await
tester
.
pump
();
// triggers a frame
...
...
examples/flutter_gallery/test/smoke_test.dart
View file @
580c844c
...
@@ -139,6 +139,7 @@ Future<Null> smokeGallery(WidgetTester tester) async {
...
@@ -139,6 +139,7 @@ Future<Null> smokeGallery(WidgetTester tester) async {
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
new
GalleryApp
(
new
GalleryApp
(
testMode:
true
,
onSendFeedback:
()
{
onSendFeedback:
()
{
sendFeedbackButtonPressed
=
true
;
// see smokeOptionsPage()
sendFeedbackButtonPressed
=
true
;
// see smokeOptionsPage()
},
},
...
...
examples/flutter_gallery/test/update_test.dart
View file @
580c844c
...
@@ -17,7 +17,12 @@ void main() {
...
@@ -17,7 +17,12 @@ void main() {
// Regression test for https://github.com/flutter/flutter/pull/5168
// Regression test for https://github.com/flutter/flutter/pull/5168
testWidgets
(
'update dialog'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'update dialog'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
GalleryApp
(
updateUrlFetcher:
mockUpdateUrlFetcher
));
await
tester
.
pumpWidget
(
const
GalleryApp
(
testMode:
true
,
updateUrlFetcher:
mockUpdateUrlFetcher
)
);
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
await
tester
.
pump
();
// triggers a frame
await
tester
.
pump
();
// triggers a frame
...
...
examples/flutter_gallery/test_driver/memory_nav.dart
View file @
580c844c
...
@@ -3,9 +3,13 @@
...
@@ -3,9 +3,13 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter_driver/driver_extension.dart'
;
import
'package:flutter_driver/driver_extension.dart'
;
import
'package:flutter_gallery/main.dart'
as
app
;
import
'package:flutter_gallery/gallery/app.dart'
show
GalleryApp
;
import
'package:flutter/material.dart'
;
void
main
(
)
{
void
main
(
)
{
enableFlutterDriverExtension
();
enableFlutterDriverExtension
();
app
.
main
();
// As in lib/main.dart: overriding https://github.com/flutter/flutter/issues/13736
// for better visual effect at the cost of performance.
MaterialPageRoute
.
debugEnableFadingRoutes
=
true
;
// ignore: deprecated_member_use
runApp
(
const
GalleryApp
(
testMode:
true
));
}
}
examples/flutter_gallery/test_driver/scroll_perf.dart
View file @
580c844c
...
@@ -3,9 +3,13 @@
...
@@ -3,9 +3,13 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter_driver/driver_extension.dart'
;
import
'package:flutter_driver/driver_extension.dart'
;
import
'package:flutter_gallery/main.dart'
as
app
;
import
'package:flutter_gallery/gallery/app.dart'
show
GalleryApp
;
import
'package:flutter/material.dart'
;
void
main
(
)
{
void
main
(
)
{
enableFlutterDriverExtension
();
enableFlutterDriverExtension
();
app
.
main
();
// As in lib/main.dart: overriding https://github.com/flutter/flutter/issues/13736
// for better visual effect at the cost of performance.
MaterialPageRoute
.
debugEnableFadingRoutes
=
true
;
// ignore: deprecated_member_use
runApp
(
const
GalleryApp
(
testMode:
true
));
}
}
examples/flutter_gallery/test_driver/transitions_perf.dart
View file @
580c844c
...
@@ -7,7 +7,8 @@ import 'dart:convert' show JsonEncoder;
...
@@ -7,7 +7,8 @@ import 'dart:convert' show JsonEncoder;
import
'package:flutter_driver/driver_extension.dart'
;
import
'package:flutter_driver/driver_extension.dart'
;
import
'package:flutter_gallery/gallery/demos.dart'
;
import
'package:flutter_gallery/gallery/demos.dart'
;
import
'package:flutter_gallery/main.dart'
as
app
;
import
'package:flutter_gallery/gallery/app.dart'
show
GalleryApp
;
import
'package:flutter/material.dart'
;
Future
<
String
>
_handleMessages
(
String
message
)
async
{
Future
<
String
>
_handleMessages
(
String
message
)
async
{
assert
(
message
==
'demoNames'
);
assert
(
message
==
'demoNames'
);
...
@@ -18,5 +19,8 @@ Future<String> _handleMessages(String message) async {
...
@@ -18,5 +19,8 @@ Future<String> _handleMessages(String message) async {
void
main
(
)
{
void
main
(
)
{
enableFlutterDriverExtension
(
handler:
_handleMessages
);
enableFlutterDriverExtension
(
handler:
_handleMessages
);
app
.
main
();
// As in lib/main.dart: overriding https://github.com/flutter/flutter/issues/13736
// for better visual effect at the cost of performance.
MaterialPageRoute
.
debugEnableFadingRoutes
=
true
;
// ignore: deprecated_member_use
runApp
(
const
GalleryApp
(
testMode:
true
));
}
}
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