Merge lp:~martin-borho/ubuntu-weather-app/new-toolbar-items into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Martin Borho
Status: Merged
Approved by: Raúl Yeguas
Approved revision: 58
Merged at revision: 55
Proposed branch: lp:~martin-borho/ubuntu-weather-app/new-toolbar-items
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 292 lines (+96/-69)
8 files modified
components/AddLocationPage.qml (+9/-1)
components/LocationManagerPage.qml (+16/-9)
components/LocationTab.qml (+38/-27)
components/SettingsPage.qml (+20/-14)
tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py (+7/-12)
tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py (+2/-2)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+1/-1)
tests/autopilot/ubuntu_weather_app/tests/test_settings.py (+3/-3)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/new-toolbar-items
Reviewer Review Type Date Requested Status
Raúl Yeguas Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+173075@code.launchpad.net

Commit message

Replaced deprecated ToolbarAction with new ToolbarItems with named ToolbarButton components

Description of the change

* Replaced ToolbarAction with new ToolbarItems with named ToolbarButton components.
* Temporary fix in ubuntusdk.py to get autopilot tests work with new ToolbarItems and objectNames, will be replaced when new emulator will land.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Raúl Yeguas (neokore) wrote :

It works as good as before, so good replace!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components/AddLocationPage.qml'
--- components/AddLocationPage.qml 2013-06-17 18:44:20 +0000
+++ components/AddLocationPage.qml 2013-07-04 18:27:28 +0000
@@ -7,9 +7,17 @@
7 objectName: "AddLocationPage"7 objectName: "AddLocationPage"
8 title: i18n.tr("Add city")8 title: i18n.tr("Add city")
9 visible: false9 visible: false
10 tools: ToolbarActions{10 tools: ToolbarItems{
11 locked: true11 locked: true
12 opened: true12 opened: true
13 back: ToolbarButton {
14 objectName: "BackButton"
15 iconSource: Qt.resolvedUrl("../resources/images/back@18.png")
16 text: i18n.tr("Back")
17 onTriggered: {
18 if(pageStack.depth === 3) pageStack.pop()
19 }
20 }
13 }21 }
1422
15 WorkerScript {23 WorkerScript {
1624
=== modified file 'components/LocationManagerPage.qml'
--- components/LocationManagerPage.qml 2013-06-17 18:44:20 +0000
+++ components/LocationManagerPage.qml 2013-07-04 18:27:28 +0000
@@ -11,18 +11,25 @@
1111
12 property bool locationsChanged: false12 property bool locationsChanged: false
1313
14 tools: ToolbarActions {14 tools: ToolbarItems {
15 locked: true15 locked: true
16 opened: (locationModel.count > 0) ? true : false16 opened: (locationModel.count > 0) ? true : false
17 back.onTriggered: {17 back: ToolbarButton {
18 if(locationsChanged) {18 objectName: "BackButton"
19 mainView.refreshData()19 text: i18n.tr("Back")
20 locationsChanged = false;20 iconSource: Qt.resolvedUrl("../resources/images/back@18.png")
21 onTriggered: {
22 if(locationsChanged) {
23 mainView.refreshData()
24 locationsChanged = false;
25 }
26 // handle dummy "current location" item
27 currentLocationItem.visible = false
28 locationLookupItem.visible = true
29 lookupItemAddButton.visible = true
30
31 if(pageStack.depth === 2) pageStack.pop()
21 }32 }
22 // handle dummy "current location" item
23 currentLocationItem.visible = false
24 locationLookupItem.visible = true
25 lookupItemAddButton.visible = true
26 }33 }
27 }34 }
2835
2936
=== modified file 'components/LocationTab.qml'
--- components/LocationTab.qml 2013-06-20 11:18:17 +0000
+++ components/LocationTab.qml 2013-07-04 18:27:28 +0000
@@ -55,33 +55,44 @@
5555
56 // Menu for options56 // Menu for options
57 page: Page {57 page: Page {
5858 id: locationPage
59 tools: ToolbarActions {59 tools: ToolbarItems {
60 Action {60 id: pageTools
61 id: refreshAction61 ToolbarButton {
62 iconSource: Qt.resolvedUrl("../resources/images/refresh_icon.png")62 objectName: "RefreshButton"
63 text: i18n.tr("Refresh")63 action:Action {
6464 id: refreshAction
65 onTriggered: {65 objectName: "RefreshAction"
66 mainView.refreshData(false, true);66 iconSource: Qt.resolvedUrl("../resources/images/refresh_icon.png")
67 }67 text: i18n.tr("Refresh")
68 }68
69 Action {69 onTriggered: {
70 id: editLocationAction70 mainView.refreshData(false, true);
71 iconSource: Qt.resolvedUrl("../resources/images/add_icon.png")71 }
72 text: i18n.tr("Edit")72 }
7373 }
74 onTriggered: {74 ToolbarButton {
75 mainView.showLocationManager()75 objectName: "EditButton"
76 }76 action:Action {
77 }77 id: editLocationAction
78 Action {78 iconSource: Qt.resolvedUrl("../resources/images/add_icon.png")
79 id: configAction79 text: i18n.tr("Edit")
80 iconSource: Qt.resolvedUrl("../resources/images/refresh_icon.png")80
81 text: i18n.tr("Settings")81 onTriggered: {
8282 mainView.showLocationManager()
83 onTriggered: {83 }
84 mainView.showSettingsPage();84 }
85 }
86 ToolbarButton {
87 objectName: "SettingsButton"
88 action:Action {
89 id: configAction
90 iconSource: Qt.resolvedUrl("../resources/images/refresh_icon.png")
91 text: i18n.tr("Settings")
92
93 onTriggered: {
94 mainView.showSettingsPage();
95 }
85 }96 }
86 }97 }
87 }98 }
8899
=== modified file 'components/SettingsPage.qml'
--- components/SettingsPage.qml 2013-06-26 11:23:17 +0000
+++ components/SettingsPage.qml 2013-07-04 18:27:28 +0000
@@ -11,23 +11,29 @@
1111
12 property bool settingsChanged: false12 property bool settingsChanged: false
1313
14 tools: ToolbarActions {14 tools: ToolbarItems {
15 locked: true15 locked: true
16 opened: true16 opened: true
17 back.onTriggered: {17 back: ToolbarButton {
18 if(settingsChanged) {18 objectName: "BackButton"
19 if(imperialSwitch.checked){19 text: i18n.tr("Back")
20 storage.saveSetting("units","imperial");20 iconSource: Qt.resolvedUrl("../resources/images/back@18.png")
21 }else{21 onTriggered: {
22 storage.saveSetting("units","metric");22 if(settingsChanged) {
23 if(imperialSwitch.checked){
24 storage.saveSetting("units","imperial");
25 }else{
26 storage.saveSetting("units","metric");
27 }
28 storage.getSettings(function(storedSettings) {
29 for(var settingName in storedSettings) {
30 settings[settingName] = storedSettings[settingName];
31 }
32 refreshData(true);
33 });
34 settingsChanged = false;
23 }35 }
24 storage.getSettings(function(storedSettings) {36 if(pageStack.depth === 2) pageStack.pop()
25 for(var settingName in storedSettings) {
26 settings[settingName] = storedSettings[settingName];
27 }
28 refreshData(true);
29 });
30 settingsChanged = false;
31 }37 }
32 }38 }
33 }39 }
3440
=== added file 'resources/images/back@18.png'
35Binary files resources/images/back@18.png 1970-01-01 00:00:00 +0000 and resources/images/back@18.png 2013-07-04 18:27:28 +0000 differ41Binary files resources/images/back@18.png 1970-01-01 00:00:00 +0000 and resources/images/back@18.png 2013-07-04 18:27:28 +0000 differ
=== modified file 'tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py'
--- tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py 2013-06-26 09:57:48 +0000
+++ tests/autopilot/ubuntu_weather_app/emulators/ubuntusdk.py 2013-07-04 18:27:28 +0000
@@ -63,27 +63,22 @@
63 """Returns the toolbar in the main events view."""63 """Returns the toolbar in the main events view."""
64 return self.app.select_single("Toolbar")64 return self.app.select_single("Toolbar")
6565
66 def get_toolbar_button(self, buttonLabel):66 def get_toolbar_button(self, buttonName):
67 """Returns the toolbar button at position index"""67 """Returns the toolbar button at position index"""
68 toolbar = self.get_toolbar()68 toolbar = self.get_toolbar()
69 if not toolbar.opened:69 if not toolbar.opened:
70 self.open_toolbar()70 self.open_toolbar()
71 row = toolbar.select_single("ToolbarActions")71 button = self.get_object('ActionItem', buttonName)
72 loaderList = row.select_many("QQuickLoader")72 return button
73 for loader in loaderList:
74 buttonList = loader.select_many("Button")
75 for button in buttonList:
76 if button.text == buttonLabel:
77 return button
7873
79 def click_toolbar_button(self, buttonLabel):74 def click_toolbar_button(self, buttonName):
80 """Clicks the toolbar button with buttonLabel"""75 """Clicks the toolbar button with buttonLabel"""
81 #The toolbar button is assumed to be the following format76 #The toolbar button is assumed to be the following format
82 #ToolbarActions {77 #ToolbarItems {
83 # Action {78 # ToolbarButton {
84 # objectName: "name"79 # objectName: "name"
85 # text: value80 # text: value
86 button = self.get_toolbar_button(buttonLabel)81 button = self.get_toolbar_button(buttonName)
87 self.autopilot.pointing_device.click_object(button)82 self.autopilot.pointing_device.click_object(button)
8883
89 def open_toolbar(self):84 def open_toolbar(self):
9085
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-06-26 09:58:37 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-07-04 18:27:28 +0000
@@ -99,7 +99,7 @@
99 def test_cancel_adding_location(self):99 def test_cancel_adding_location(self):
100 """Cancel the cities search"""100 """Cancel the cities search"""
101 self._open_add_location_page()101 self._open_add_location_page()
102 self.main_window.click_toolbar_button("Back")102 self.main_window.click_toolbar_button("BackButton")
103 locationList = self.main_window.get_object('QQuickListView', 'LocationList')103 locationList = self.main_window.get_object('QQuickListView', 'LocationList')
104 self.assertThat(locationList.visible, Eventually(Equals(True)))104 self.assertThat(locationList.visible, Eventually(Equals(True)))
105105
@@ -117,7 +117,7 @@
117 """Opens the location manager"""117 """Opens the location manager"""
118 self.main_window.open_toolbar()118 self.main_window.open_toolbar()
119 self.assertThat(self.main_window.get_toolbar().opened, Eventually(Equals(True)))119 self.assertThat(self.main_window.get_toolbar().opened, Eventually(Equals(True)))
120 self.main_window.click_toolbar_button("Edit")120 self.main_window.click_toolbar_button("EditButton")
121121
122 def test_remove_location(self):122 def test_remove_location(self):
123 """Removes location"""123 """Removes location"""
124124
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-06-26 11:12:34 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-07-04 18:27:28 +0000
@@ -55,7 +55,7 @@
55 tab2_curr_date = curr_dates[1].text55 tab2_curr_date = curr_dates[1].text
5656
57 # refresh and wait till loading has finished57 # refresh and wait till loading has finished
58 self.main_window.click_toolbar_button("Refresh")58 self.main_window.click_toolbar_button("RefreshButton")
59 load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')59 load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')
60 self.assertThat(load_indicator.running, Eventually(Equals(False)))60 self.assertThat(load_indicator.running, Eventually(Equals(False)))
6161
6262
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-06-26 10:43:49 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-07-04 18:27:28 +0000
@@ -28,7 +28,7 @@
28 """Opens the settings page"""28 """Opens the settings page"""
29 self.main_window.open_toolbar()29 self.main_window.open_toolbar()
30 self.assertThat(self.main_window.get_toolbar().opened, Eventually(Equals(True)))30 self.assertThat(self.main_window.get_toolbar().opened, Eventually(Equals(True)))
31 self.main_window.click_toolbar_button("Settings")31 self.main_window.click_toolbar_button("SettingsButton")
3232
33 def test_switch_scale(self):33 def test_switch_scale(self):
34 """Tests switching the scale in the settings"""34 """Tests switching the scale in the settings"""
@@ -44,7 +44,7 @@
44 self.assertThat(switch.checked, Eventually(Equals(False)))44 self.assertThat(switch.checked, Eventually(Equals(False)))
45 self.pointing_device.click_object(switch)45 self.pointing_device.click_object(switch)
46 self.assertThat(switch.checked, Eventually(Equals(True)))46 self.assertThat(switch.checked, Eventually(Equals(True)))
47 self.main_window.click_toolbar_button("Back")47 self.main_window.click_toolbar_button("BackButton")
4848
49 # wait for reload and check the imperial values49 # wait for reload and check the imperial values
50 load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')50 load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')
@@ -60,7 +60,7 @@
60 self.assertThat(switch.checked, Eventually(Equals(True)))60 self.assertThat(switch.checked, Eventually(Equals(True)))
61 self.pointing_device.click_object(switch)61 self.pointing_device.click_object(switch)
62 self.assertThat(switch.checked, Eventually(Equals(False)))62 self.assertThat(switch.checked, Eventually(Equals(False)))
63 self.main_window.click_toolbar_button("Back")63 self.main_window.click_toolbar_button("BackButton")
6464
65 # wait for reload and check the metric values again65 # wait for reload and check the metric values again
66 load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')66 load_indicator = self.main_window.get_object('ActivityIndicator', 'LoadingSpinner')

Subscribers

People subscribed via source and target branches