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
1=== modified file 'tests/autopilot/webbrowser_app/emulators/browser.py'
2--- tests/autopilot/webbrowser_app/emulators/browser.py 2015-09-29 10:59:50 +0000
3+++ tests/autopilot/webbrowser_app/emulators/browser.py 2015-10-02 22:16:21 +0000
4@@ -317,7 +317,7 @@
5 objectName="bookmarkToggle")
6
7 def get_find_in_page_counter(self):
8- return self.select_single(objectName="findInPageCounter")
9+ return self.select_single("Label", objectName="findInPageCounter")
10
11
12 class TabsBar(uitk.UbuntuUIToolkitCustomProxyObjectBase):
13@@ -522,7 +522,7 @@
14 return self.select_single(UrlsList, objectName="topSitesList")
15
16 def get_notopsites_label(self):
17- return self.select_single(objectName="notopsites")
18+ return self.select_single("Label", objectName="notopsites")
19
20 def get_top_site_items(self):
21 return self.get_top_sites_list().get_delegates()
22@@ -658,7 +658,7 @@
23 class ContextMenuBase(uitk.UbuntuUIToolkitCustomProxyObjectBase):
24
25 def get_title_label(self):
26- return self.select_single(objectName="titleLabel")
27+ return self.select_single("Label", objectName="titleLabel")
28
29 def get_visible_actions(self):
30 return self.select_many("Empty", visible=True)
31
32=== added file 'tests/unittests/qml/qml_tree_helpers.js'
33--- tests/unittests/qml/qml_tree_helpers.js 1970-01-01 00:00:00 +0000
34+++ tests/unittests/qml/qml_tree_helpers.js 2015-10-02 22:16:21 +0000
35@@ -0,0 +1,42 @@
36+/*
37+ * Copyright 2015 Canonical Ltd.
38+ *
39+ * This file is part of webbrowser-app.
40+ *
41+ * webbrowser-app is free software; you can redistribute it and/or modify
42+ * it under the terms of the GNU General Public License as published by
43+ * the Free Software Foundation; version 3.
44+ *
45+ * webbrowser-app is distributed in the hope that it will be useful,
46+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
47+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48+ * GNU General Public License for more details.
49+ *
50+ * You should have received a copy of the GNU General Public License
51+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
52+ */
53+
54+// Given the naming convention in QML for class names, we should
55+// never have a class name with underscores in it, so the following
56+// should be a safe way to remove the rest of the extra metatype
57+// information produced by converting QML objects to strings.
58+function qmlType(item) {
59+ return String(item).split("_")[0]
60+}
61+
62+function findDescendantsByType(item, type, list) {
63+ list = list || []
64+ if (qmlType(item) === type) list.push(item)
65+ for (var i in item.children) {
66+ findDescendantsByType(item.children[i], type, list)
67+ }
68+ return list
69+}
70+
71+function findAncestorByType(item, type) {
72+ while (item.parent) {
73+ if (qmlType(item.parent) === type) return item.parent
74+ item = item.parent
75+ }
76+ return null
77+}
78
79=== modified file 'tests/unittests/qml/tst_TabsBar.qml'
80--- tests/unittests/qml/tst_TabsBar.qml 2015-10-01 19:53:14 +0000
81+++ tests/unittests/qml/tst_TabsBar.qml 2015-10-02 22:16:21 +0000
82@@ -21,6 +21,7 @@
83 import Ubuntu.Test 1.0
84 import "../../../src/app/webbrowser"
85 import webbrowserapp.private 0.1
86+import "qml_tree_helpers.js" as Tree
87
88 Item {
89 id: root
90@@ -80,14 +81,36 @@
91 signalName: "reload"
92 }
93
94+ // Ideally we would get menu items by their objectName, however they are
95+ // created dynamically by the ActionSelectionPopover and the objectName
96+ // of the source action is not copied to the generated item.
97+ // So we first select the source Action by objectName then look for an item
98+ // with the same text as the action. This is not ideal but it will work
99+ // since we don't have items with the same text.
100+ // https://launchpad.net/bugs/1205144 tracks the issue, and as of 2015-09-23
101+ // is fixed in the vivid overlay PPA but not in wily yet.
102+ function getMenuItemForAction(menu, actionName) {
103+ actionName = "tab_action_" + actionName
104+ var text = ""
105+ var actions = menu.actions.actions
106+ for (var i = 0; i < actions.length; i++) {
107+ if (actions[i].objectName === actionName) {
108+ text = actions[i].text
109+ break
110+ }
111+ }
112+ if (text === "") return null
113+
114+ var menuItems = Tree.findDescendantsByType(menu, "Label")
115+ var matching = menuItems.filter(function(item) { return item.text === text })
116+ if (matching.length === 0) return null
117+ else return Tree.findAncestorByType(matching[0], "Empty")
118+ }
119+
120 UbuntuTestCase {
121 name: "TabsBar"
122 when: windowShown
123
124- function getMenuItemForAction(menu, actionName) {
125- return findChild(menu, "tab_action_" + actionName + "_button")
126- }
127-
128 function clickItem(item, button) {
129 if (button === undefined) button = Qt.LeftButton
130 var center = centerOf(item)

Subscribers

People subscribed via source and target branches

to status/vote changes: