on xenial help sign in
fix the language tests
282c933Lukáš Tinkl
qml/Wizard/Pages/10-language.qml+2−1
@@ -108,6 +108,7 @@ LocalComponents.Page {
108
108
109 delegate: ListItem {
109 delegate: ListItem {
110 id: itemDelegate
110 id: itemDelegate
111+ objectName: "languageDelegate" + index
111 highlightColor: backgroundColor
112 highlightColor: backgroundColor
112 readonly property bool isCurrent: index === ListView.view.currentIndex
113 readonly property bool isCurrent: index === ListView.view.currentIndex
113
114
@@ -151,7 +152,7 @@ LocalComponents.Page {
151 id: forwardButton
152 id: forwardButton
152 LocalComponents.StackButton {
153 LocalComponents.StackButton {
153 text: i18n.tr("Next")
154 text: i18n.tr("Next")
154− enabled: languagesListView.currentIndex
155+ enabled: languagesListView.currentIndex != -1
155 onClicked: {
156 onClicked: {
156 if (plugin.currentLanguage !== languagesListView.currentIndex) {
157 if (plugin.currentLanguage !== languagesListView.currentIndex) {
157 plugin.currentLanguage = languagesListView.currentIndex;
158 plugin.currentLanguage = languagesListView.currentIndex;
tests/mocks/Ubuntu/SystemSettings/CMakeLists.txt+1−1
@@ -1,2 +1,2 @@
1−#add_subdirectory(LanguagePlugin)
1+add_subdirectory(LanguagePlugin)
2add_subdirectory(SecurityPrivacy)
2add_subdirectory(SecurityPrivacy)
tests/mocks/Ubuntu/SystemSettings/LanguagePlugin/MockLanguagePlugin.qml+1−1
@@ -18,6 +18,6 @@ import QtQuick 2.4
18
18
19Item {
19Item {
20 property var languageNames: ["English", "French", "Spanish"]
20 property var languageNames: ["English", "French", "Spanish"]
21− property var languageCodes: ["en", "fr", "es"]
21+ property var languageCodes: ["en_US", "fr_FR", "es_ES"]
22 property int currentLanguage: 0
22 property int currentLanguage: 0
23}
23}
tests/qmltests/Wizard/tst_Wizard.qml+7−18
@@ -221,28 +221,17 @@ Item {
221
221
222 function test_languageChange() {
222 function test_languageChange() {
223 var page = goToPage("languagePage");
223 var page = goToPage("languagePage");
224− tap(findChild(page, "languageCombo"));
224+ tap(findChild(page, "languageDelegate1")); // should invoke "fr" lang
225− waitForRendering(findChild(page, "languageDelegate1"));
225+
226−
227− // For some reason, the delegate *sometimes* (like 1 in 10 maybe)
228− // needs more time before it can process a tap() call. I can't
229− // find a rhyme or reason, its properties all seem the same in
230− // cases where it works and does not. This failure to receive a
231− // tap() call below does *not* happen when running in xvfb, so
232− // jenkins is unaffected (and we don't have to worry about 100 not
233− // being enough time in its slow environment). This wait() call is
234− // just to help local runs not trip up.
235− wait(100);
236− tap(findChild(page, "languageDelegate1"));
237−
238− tryCompare(i18n, "language", "fr");
226+ tryCompare(i18n, "language", "fr_FR");
239 tap(findChild(page, "forwardButton"));
227 tap(findChild(page, "forwardButton"));
240 tryCompare(updateSessionLanguageSpy, "count", 1);
228 tryCompare(updateSessionLanguageSpy, "count", 1);
241− compare(updateSessionLanguageSpy.signalArguments[0][0], "fr");
229+ compare(updateSessionLanguageSpy.signalArguments[0][0], "fr_FR");
242 }
230 }
243
231
244 function test_languageNoChange() {
232 function test_languageNoChange() {
245− goToPage("simPage"); // one past language page
233+ var page = goToPage("languagePage"); // one past language page
234+ tap(findChild(page, "forwardButton"));
246 compare(updateSessionLanguageSpy.count, 0);
235 compare(updateSessionLanguageSpy.count, 0);
247 }
236 }
248
237
@@ -449,7 +438,7 @@ Item {
449 }
438 }
450
439
451 function test_locationGpsOnly() {
440 function test_locationGpsOnly() {
452− var page = goToPage("locationPage");
441+ var page = goToPage("locationPage", true);
453 var gpsCheck = findChild(page, "gpsCheckLabel");
442 var gpsCheck = findChild(page, "gpsCheckLabel");
454 var hereCheck = findChild(page, "hereCheckLabel");
443 var hereCheck = findChild(page, "hereCheckLabel");
455 var nopeCheck = findChild(page, "nopeCheckLabel");
444 var nopeCheck = findChild(page, "nopeCheckLabel");