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
72716984
Commit
72716984
authored
Oct 03, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1458 from Hixie/dismiss-1215
Regression test for #1215
parents
aea77929
846a073a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
5 deletions
+58
-5
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+5
-1
dismissable_test.dart
packages/unit/test/widget/dismissable_test.dart
+53
-4
No files found.
packages/flutter/lib/src/widgets/framework.dart
View file @
72716984
...
@@ -181,7 +181,11 @@ abstract class Widget {
...
@@ -181,7 +181,11 @@ abstract class Widget {
/// Inflates this configuration to a concrete instance.
/// Inflates this configuration to a concrete instance.
Element
createElement
();
Element
createElement
();
String
toString
()
=>
'
$runtimeType
'
;
String
toString
()
{
if
(
key
==
null
)
return
'
$runtimeType
'
;
return
'
$runtimeType
-
$key
'
;
}
}
}
/// RenderObjectWidgets provide the configuration for [RenderObjectElement]s,
/// RenderObjectWidgets provide the configuration for [RenderObjectElement]s,
...
...
packages/unit/test/widget/dismissable_test.dart
View file @
72716984
import
'package:sky/rendering.dart'
;
import
'package:sky/widgets.dart'
;
import
'package:sky/widgets.dart'
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
...
@@ -44,13 +45,11 @@ Widget widgetBuilder() {
...
@@ -44,13 +45,11 @@ Widget widgetBuilder() {
);
);
}
}
void
dismissItem
(
WidgetTester
tester
,
int
item
,
{
DismissDirection
gestureDirection
})
{
void
dismissElement
(
WidgetTester
tester
,
Element
itemElement
,
{
DismissDirection
gestureDirection
})
{
assert
(
itemElement
!=
null
);
assert
(
gestureDirection
!=
DismissDirection
.
horizontal
);
assert
(
gestureDirection
!=
DismissDirection
.
horizontal
);
assert
(
gestureDirection
!=
DismissDirection
.
vertical
);
assert
(
gestureDirection
!=
DismissDirection
.
vertical
);
Element
itemElement
=
tester
.
findText
(
item
.
toString
());
expect
(
itemElement
,
isNotNull
);
Point
downLocation
;
Point
downLocation
;
Point
upLocation
;
Point
upLocation
;
switch
(
gestureDirection
)
{
switch
(
gestureDirection
)
{
...
@@ -84,12 +83,35 @@ void dismissItem(WidgetTester tester, int item, { DismissDirection gestureDirect
...
@@ -84,12 +83,35 @@ void dismissItem(WidgetTester tester, int item, { DismissDirection gestureDirect
tester
.
dispatchEvent
(
pointer
.
down
(
downLocation
),
downLocation
);
tester
.
dispatchEvent
(
pointer
.
down
(
downLocation
),
downLocation
);
tester
.
dispatchEvent
(
pointer
.
move
(
upLocation
),
downLocation
);
tester
.
dispatchEvent
(
pointer
.
move
(
upLocation
),
downLocation
);
tester
.
dispatchEvent
(
pointer
.
up
(),
downLocation
);
tester
.
dispatchEvent
(
pointer
.
up
(),
downLocation
);
}
void
dismissItem
(
WidgetTester
tester
,
int
item
,
{
DismissDirection
gestureDirection
})
{
assert
(
gestureDirection
!=
DismissDirection
.
horizontal
);
assert
(
gestureDirection
!=
DismissDirection
.
vertical
);
Element
itemElement
=
tester
.
findText
(
item
.
toString
());
expect
(
itemElement
,
isNotNull
);
dismissElement
(
tester
,
itemElement
,
gestureDirection:
gestureDirection
);
tester
.
pumpWidget
(
widgetBuilder
());
// start the resize animation
tester
.
pumpWidget
(
widgetBuilder
());
// start the resize animation
tester
.
pumpWidget
(
widgetBuilder
(),
const
Duration
(
seconds:
1
));
// finish the resize animation
tester
.
pumpWidget
(
widgetBuilder
(),
const
Duration
(
seconds:
1
));
// finish the resize animation
tester
.
pumpWidget
(
widgetBuilder
(),
const
Duration
(
seconds:
1
));
// dismiss
tester
.
pumpWidget
(
widgetBuilder
(),
const
Duration
(
seconds:
1
));
// dismiss
}
}
class
Test1215DismissableComponent
extends
StatelessComponent
{
Test1215DismissableComponent
(
this
.
text
);
final
String
text
;
Widget
build
(
BuildContext
context
)
{
return
new
Dismissable
(
child:
new
AspectRatio
(
aspectRatio:
1.0
,
child:
new
Text
(
this
.
text
)
)
);
}
}
void
main
(
)
{
void
main
(
)
{
test
(
'Horizontal drag triggers dismiss scrollDirection=vertical'
,
()
{
test
(
'Horizontal drag triggers dismiss scrollDirection=vertical'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
...
@@ -230,4 +252,31 @@ void main() {
...
@@ -230,4 +252,31 @@ void main() {
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
});
});
});
});
// This one is for
// https://github.com/flutter/engine/issues/1215
test
(
'dismissing bottom then top (smoketest)'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Center
(
child:
new
Container
(
width:
100.0
,
height:
1000.0
,
child:
new
Column
([
new
Test1215DismissableComponent
(
'1'
),
new
Test1215DismissableComponent
(
'2'
)
])
)
));
expect
(
tester
.
findText
(
'1'
),
isNotNull
);
expect
(
tester
.
findText
(
'2'
),
isNotNull
);
dismissElement
(
tester
,
tester
.
findText
(
'2'
),
gestureDirection:
DismissDirection
.
right
);
tester
.
pump
(
new
Duration
(
seconds:
1
));
expect
(
tester
.
findText
(
'1'
),
isNotNull
);
expect
(
tester
.
findText
(
'2'
),
isNull
);
dismissElement
(
tester
,
tester
.
findText
(
'1'
),
gestureDirection:
DismissDirection
.
right
);
tester
.
pump
(
new
Duration
(
seconds:
1
));
expect
(
tester
.
findText
(
'1'
),
isNull
);
expect
(
tester
.
findText
(
'2'
),
isNull
);
});
});
}
}
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