on xenial help sign in
add objectNames for wizard tests
commit9d2e0c040583c288812c2d247a5967fb78c9a94f authorOmer Akram <omer.akram@canonical.com> dateMon 18 Jul 2016, 23:48 (10 years ago) parent65b1efb
4 files changed+14−4
qml/Wizard/Pages/10-welcome.qml+6−1 qml/Wizard/Pages/30-wifi.qml+6−1 tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+1−1 tests/qmltests/Wizard/tst_Wizard.qml+1−1
qml/Wizard/Pages/10-welcome.qml+6−1
@@ -110,6 +110,7 @@ LocalComponents.Page {
110110
111111 ListView {
112112 id: languagesListView
113+ objectName: "languagesListView"
113114 clip: true
114115 snapMode: ListView.SnapToItem
115116
@@ -124,12 +125,16 @@ LocalComponents.Page {
124125
125126 delegate: ListItem {
126127 id: itemDelegate
127− objectName: "languageDelegate" + index
128+ objectName: getObjectName()
128129 highlightColor: backgroundColor
129130 divider.colorFrom: dividerColor
130131 divider.colorTo: backgroundColor
131132 readonly property bool isCurrent: index === ListView.view.currentIndex
132133
134+ function getObjectName() {
135+ return "languageDelegate_" + langLabel.text.toLowerCase().replace(/\s+/g, '_')
136+ }
137+
133138 Label {
134139 id: langLabel
135140 text: modelData
qml/Wizard/Pages/30-wifi.qml+6−1
@@ -72,7 +72,7 @@ LocalComponents.Page {
7272 id: accessPointComponent
7373 ListItem {
7474 id: accessPoint
75− objectName: "accessPoint"
75+ objectName: getObjectName()
7676 highlightColor: backgroundColor
7777 enabled: menuData && menuData.sensitive || false
7878 divider.colorFrom: dividerColor
@@ -93,6 +93,10 @@ LocalComponents.Page {
9393 readonly property int signalStrength: strengthAction.valid ? strengthAction.state : 0
9494 property int menuIndex: -1
9595
96+ function getObjectName() {
97+ "accessPoint_" + apName.text.toLowerCase().replace(/\s+/g, '_')
98+ }
99+
96100 function loadAttributes() {
97101 if (!unityMenuModel || menuIndex == -1) return;
98102 unityMenuModel.loadExtendedAttributes(menuIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
@@ -166,6 +170,7 @@ LocalComponents.Page {
166170
167171 ListView {
168172 id: listview
173+ objectName: "accessPointsListView"
169174 anchors.left: parent.left
170175 anchors.right: parent.right
171176 clip: true
tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+1−1
@@ -580,7 +580,7 @@ Item {
580580 loader.data = menuData;
581581 loader.sourceComponent = factory.load(menuData);
582582 tryCompareFunction(function() { return loader.item != undefined; }, true);
583− compare(loader.item.objectName, "accessPoint", "Should have created a access point menu");
583+ compare(loader.item.objectName, "accessPoint_" + menuData.label, "Should have created a access point menu");
584584
585585 compare(loader.item.text, data.label, "Label does not match data");
586586 compare(loader.item.strengthAction.name, "action::strength", "Strength action incorrect");
tests/qmltests/Wizard/tst_Wizard.qml+1−1
@@ -223,7 +223,7 @@ Item {
223223
224224 function test_languageChange() {
225225 var page = goToPage("languagePage");
226− tap(findChild(page, "languageDelegate1")); // should invoke "fr" lang
226+ tap(findChild(page, "languageDelegate_français_(france)")); // should invoke "fr" lang
227227
228228 tryCompare(i18n, "language", "fr_FR");
229229 tap(findChild(page, "forwardButton"));