on xenial help sign in
fix tests
8d1a4aaMichael Zanetti
qml/Launcher/Drawer.qml+3
@@ -110,6 +110,7 @@ FocusScope {
110
110
111 Sections {
111 Sections {
112 id: sections
112 id: sections
113+ objectName: "drawerSections"
113 width: parent.width
114 width: parent.width
114
115
115 KeyNavigation.up: searchField
116 KeyNavigation.up: searchField
@@ -138,6 +139,7 @@ FocusScope {
138
139
139 FocusScope {
140 FocusScope {
140 id: headerFocusScope
141 id: headerFocusScope
142+ objectName: "headerFocusScope"
141 KeyNavigation.up: sections
143 KeyNavigation.up: sections
142 KeyNavigation.down: listLoader.item
144 KeyNavigation.down: listLoader.item
143 KeyNavigation.backtab: sections
145 KeyNavigation.backtab: sections
@@ -166,6 +168,7 @@ FocusScope {
166
168
167 Loader {
169 Loader {
168 id: listLoader
170 id: listLoader
171+ objectName: "drawerListLoader"
169 anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom; leftMargin: units.gu(1); rightMargin: units.gu(1) }
172 anchors { left: parent.left; top: sectionsContainer.bottom; right: parent.right; bottom: parent.bottom; leftMargin: units.gu(1); rightMargin: units.gu(1) }
170
173
171 KeyNavigation.up: headerFocusScope
174 KeyNavigation.up: headerFocusScope
tests/qmltests/Launcher/tst_Drawer.qml+40−1
@@ -136,6 +136,8 @@ StyledItem {
136 launcher.hide();
136 launcher.hide();
137 var drawer = findChild(launcher, "drawer");
137 var drawer = findChild(launcher, "drawer");
138 tryCompare(drawer, "x", -drawer.width);
138 tryCompare(drawer, "x", -drawer.width);
139+ var searchField = findChild(drawer, "searchField");
140+ searchField.text = "";
139 }
141 }
140
142
141 function test_revealByEdgeDrag() {
143 function test_revealByEdgeDrag() {
@@ -173,7 +175,7 @@ StyledItem {
173 var drawer = dragDrawerIntoView();
175 var drawer = dragDrawerIntoView();
174 waitForRendering(launcher);
176 waitForRendering(launcher);
175
177
176− mouseFlick(root, drawer.width - units.gu(1), drawer.height / 2, units.gu(2), drawer.height / 2, true, true);
178+ mouseFlick(root, drawer.width - units.gu(1), drawer.height / 2, units.gu(10), drawer.height / 2, true, true);
177
179
178 tryCompare(drawer.anchors, "rightMargin", 0);
180 tryCompare(drawer.anchors, "rightMargin", 0);
179 tryCompare(launcher, "state", data.endState);
181 tryCompare(launcher, "state", data.endState);
@@ -270,5 +272,42 @@ StyledItem {
270 typeString("cam");
272 typeString("cam");
271 tryCompare(searchField, "displayText", "cam");
273 tryCompare(searchField, "displayText", "cam");
272 }
274 }
275+
276+ function test_kbdNavigation() {
277+ launcher.openDrawer(true);
278+ waitForRendering(launcher);
279+ waitUntilTransitionsEnd(launcher);
280+ compare(launcher.lastSelectedApplication, "");
281+
282+ var drawer = findChild(launcher, "drawer");
283+ var searchField = findChild(drawer, "searchField");
284+ var sections = findChild(drawer, "drawerSections");
285+ var header = findChild(drawer, "headerFocusScope");
286+ var listLoader = findChild(drawer, "drawerListLoader");
287+
288+ tryCompare(searchField, "activeFocus", true);
289+ // for some reason, even when the searchField has activeFocus already,
290+ // it won't react on key down events if they're coming in too early...
291+ // let's repeat the press for a bit before giving up
292+ tryCompareFunction(function() {
293+ wait(10)
294+ keyClick(Qt.Key_Down);
295+ return sections.activeFocus;
296+ }, true)
297+
298+ keyClick(Qt.Key_Down);
299+ tryCompare(header, "activeFocus", true);
300+
301+ keyClick(Qt.Key_Down);
302+ tryCompare(listLoader, "activeFocus", true);
303+
304+ keyClick(Qt.Key_Down);
305+ keyClick(Qt.Key_Left);
306+ tryCompare(listLoader, "activeFocus", true);
307+
308+ keyClick(Qt.Key_Enter);
309+
310+ compare(launcher.lastSelectedApplication, "calendar-app");
311+ }
273 }
312 }
274}
313}