on xenial help sign in
adding test for auto scroll
bd27505Diego Sarmentero
tests/qmltests/Dash/Apps/tst_AppPreview.qml+21
@@ -25,6 +25,9 @@ Item {
25 width: units.gu(60)
25 width: units.gu(60)
26 height: units.gu(80)
26 height: units.gu(80)
27
27
28+ // Fake shell
29+ QtObject { id: shell; property int height: appPreview.height }
30+
28 property var calls: []
31 property var calls: []
29
32
30 SignalSpy {
33 SignalSpy {
@@ -89,6 +92,9 @@ Item {
89 reviewField.focus = false;
92 reviewField.focus = false;
90 reviewField.text = "";
93 reviewField.text = "";
91 data.rating = rating.value;
94 data.rating = rating.value;
95+ var appReviews = findChild(appPreview, "appReviews");
96+ appReviews.visible = false;
97+ appPreview.keyboardSize = 0;
92 }
98 }
93
99
94 function test_actions() {
100 function test_actions() {
@@ -163,5 +169,20 @@ Item {
163 verify(buttons.visible == true);
169 verify(buttons.visible == true);
164 }
170 }
165
171
172+ function test_automatic_scroll_on_keyboard_shown() {
173+ waitForRendering(appPreview);
174+ var appReviews = findChild(appPreview, "appReviews");
175+ appReviews.visible = true;
176+
177+ var leftFlickable = findChild(appPreview, "leftFlickable");
178+ leftFlickable.contentY = leftFlickable.contentHeight;
179+ var reviewField = findChild(appReviews, "reviewField");
180+ appPreview.keyboardSize = 400;
181+ appReviews.editing(reviewField);
182+ var newFlickPos = leftFlickable.contentY;
183+ var keyboardY = shell.height - appPreview.keyboardSize;
184+ verify(newFlickPos < keyboardY);
185+ }
186+
166 }
187 }
167}
188}