Merge lp:~osomon/webbrowser-app/revert-revision-1215 into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Rejected
Rejected by: Olivier Tilloy
Proposed branch: lp:~osomon/webbrowser-app/revert-revision-1215
Merge into: lp:webbrowser-app
Diff against target: 130 lines (+72/-7)
3 files modified
tests/autopilot/webbrowser_app/emulators/browser.py (+3/-3)
tests/unittests/qml/qml_tree_helpers.js (+42/-0)
tests/unittests/qml/tst_TabsBar.qml (+27/-4)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/revert-revision-1215
Reviewer Review Type Date Requested Status
Olivier Tilloy Disapprove
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+273301@code.launchpad.net

Commit message

Revert revision 1215 as the corresponding UITK update has been reverted.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Not needed any longer now that UITK has landed again.

review: Disapprove

Unmerged revisions

1220. By Olivier Tilloy

Revert revision 1215 as the corresponding UITK update has been reverted.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/autopilot/webbrowser_app/emulators/browser.py'
--- tests/autopilot/webbrowser_app/emulators/browser.py 2015-09-29 10:59:50 +0000
+++ tests/autopilot/webbrowser_app/emulators/browser.py 2015-10-02 22:16:21 +0000
@@ -317,7 +317,7 @@
317 objectName="bookmarkToggle")317 objectName="bookmarkToggle")
318318
319 def get_find_in_page_counter(self):319 def get_find_in_page_counter(self):
320 return self.select_single(objectName="findInPageCounter")320 return self.select_single("Label", objectName="findInPageCounter")
321321
322322
323class TabsBar(uitk.UbuntuUIToolkitCustomProxyObjectBase):323class TabsBar(uitk.UbuntuUIToolkitCustomProxyObjectBase):
@@ -522,7 +522,7 @@
522 return self.select_single(UrlsList, objectName="topSitesList")522 return self.select_single(UrlsList, objectName="topSitesList")
523523
524 def get_notopsites_label(self):524 def get_notopsites_label(self):
525 return self.select_single(objectName="notopsites")525 return self.select_single("Label", objectName="notopsites")
526526
527 def get_top_site_items(self):527 def get_top_site_items(self):
528 return self.get_top_sites_list().get_delegates()528 return self.get_top_sites_list().get_delegates()
@@ -658,7 +658,7 @@
658class ContextMenuBase(uitk.UbuntuUIToolkitCustomProxyObjectBase):658class ContextMenuBase(uitk.UbuntuUIToolkitCustomProxyObjectBase):
659659
660 def get_title_label(self):660 def get_title_label(self):
661 return self.select_single(objectName="titleLabel")661 return self.select_single("Label", objectName="titleLabel")
662662
663 def get_visible_actions(self):663 def get_visible_actions(self):
664 return self.select_many("Empty", visible=True)664 return self.select_many("Empty", visible=True)
665665
=== added file 'tests/unittests/qml/qml_tree_helpers.js'
--- tests/unittests/qml/qml_tree_helpers.js 1970-01-01 00:00:00 +0000
+++ tests/unittests/qml/qml_tree_helpers.js 2015-10-02 22:16:21 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This file is part of webbrowser-app.
5 *
6 * webbrowser-app is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * webbrowser-app is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19// Given the naming convention in QML for class names, we should
20// never have a class name with underscores in it, so the following
21// should be a safe way to remove the rest of the extra metatype
22// information produced by converting QML objects to strings.
23function qmlType(item) {
24 return String(item).split("_")[0]
25}
26
27function findDescendantsByType(item, type, list) {
28 list = list || []
29 if (qmlType(item) === type) list.push(item)
30 for (var i in item.children) {
31 findDescendantsByType(item.children[i], type, list)
32 }
33 return list
34}
35
36function findAncestorByType(item, type) {
37 while (item.parent) {
38 if (qmlType(item.parent) === type) return item.parent
39 item = item.parent
40 }
41 return null
42}
043
=== modified file 'tests/unittests/qml/tst_TabsBar.qml'
--- tests/unittests/qml/tst_TabsBar.qml 2015-10-01 19:53:14 +0000
+++ tests/unittests/qml/tst_TabsBar.qml 2015-10-02 22:16:21 +0000
@@ -21,6 +21,7 @@
21import Ubuntu.Test 1.021import Ubuntu.Test 1.0
22import "../../../src/app/webbrowser"22import "../../../src/app/webbrowser"
23import webbrowserapp.private 0.123import webbrowserapp.private 0.1
24import "qml_tree_helpers.js" as Tree
2425
25Item {26Item {
26 id: root27 id: root
@@ -80,14 +81,36 @@
80 signalName: "reload"81 signalName: "reload"
81 }82 }
8283
84 // Ideally we would get menu items by their objectName, however they are
85 // created dynamically by the ActionSelectionPopover and the objectName
86 // of the source action is not copied to the generated item.
87 // So we first select the source Action by objectName then look for an item
88 // with the same text as the action. This is not ideal but it will work
89 // since we don't have items with the same text.
90 // https://launchpad.net/bugs/1205144 tracks the issue, and as of 2015-09-23
91 // is fixed in the vivid overlay PPA but not in wily yet.
92 function getMenuItemForAction(menu, actionName) {
93 actionName = "tab_action_" + actionName
94 var text = ""
95 var actions = menu.actions.actions
96 for (var i = 0; i < actions.length; i++) {
97 if (actions[i].objectName === actionName) {
98 text = actions[i].text
99 break
100 }
101 }
102 if (text === "") return null
103
104 var menuItems = Tree.findDescendantsByType(menu, "Label")
105 var matching = menuItems.filter(function(item) { return item.text === text })
106 if (matching.length === 0) return null
107 else return Tree.findAncestorByType(matching[0], "Empty")
108 }
109
83 UbuntuTestCase {110 UbuntuTestCase {
84 name: "TabsBar"111 name: "TabsBar"
85 when: windowShown112 when: windowShown
86113
87 function getMenuItemForAction(menu, actionName) {
88 return findChild(menu, "tab_action_" + actionName + "_button")
89 }
90
91 function clickItem(item, button) {114 function clickItem(item, button) {
92 if (button === undefined) button = Qt.LeftButton115 if (button === undefined) button = Qt.LeftButton
93 var center = centerOf(item)116 var center = centerOf(item)

Subscribers

People subscribed via source and target branches

to status/vote changes: