Merge lp:~fboucault/webbrowser-app/background_open_tabs_adjacent into lp:webbrowser-app

Proposed by Florian Boucault
Status: Superseded
Proposed branch: lp:~fboucault/webbrowser-app/background_open_tabs_adjacent
Merge into: lp:webbrowser-app
Diff against target: 385 lines (+134/-80)
12 files modified
.bzrignore (+0/-1)
CMakeLists.txt (+1/-2)
make-snap.sh (+0/-4)
setup/gui/webbrowser-app.desktop.in (+0/-27)
snapcraft.yaml (+4/-1)
src/Ubuntu/Web/ua-overrides-desktop.js.in (+43/-24)
src/Ubuntu/Web/ua-overrides-mobile.js.in (+36/-14)
src/app/webbrowser/TabComponent.qml (+6/-7)
src/app/webbrowser/tabs-model.cpp (+9/-0)
src/app/webbrowser/tabs-model.h (+1/-0)
tests/autopilot/webbrowser_app/tests/test_tabs.py (+22/-0)
tests/unittests/tabs-model/tst_TabsModelTests.cpp (+12/-0)
To merge this branch: bzr merge lp:~fboucault/webbrowser-app/background_open_tabs_adjacent
Reviewer Review Type Date Requested Status
Olivier Tilloy Needs Fixing
Review via email: mp+316138@code.launchpad.net

This proposal has been superseded by a proposal from 2017-02-02.

Commit message

Make new tabs opened in the background to be placed next to the tab opening requesting them instead of at the end of the list of tabs.

Description of the change

Make new tabs opened in the background to be placed next to the tab opening requesting them instead of at the end of the list of tabs.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

Can you please re-target the merge request to lp:webbrowser-app/staging?

The "Open link in new tab" and "Open link in new background tab" context menu entries should also open the new tab next to the caller (and there should be autopilot tests for those use cases).

Also, see one minor comment inline.

review: Needs Fixing
1602. By Florian Boucault

Also apply opening new tab adjacent to current tab when using the following contextual actions:
- opening a link in a new tab
- opening a link in a new background tab
- opening an image in a new tab
- opening a video in a new tab

1603. By Florian Boucault

TabsModel unit test: deallocate memory properly

1604. By Florian Boucault

Fix AP tests in narrow mode

1605. By Florian Boucault

Merged staging

1606. By Florian Boucault

Fixed AP test test_ctrl_click_open_link_in_next_tab in narrow mode

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2016-11-02 21:14:28 +0000
3+++ .bzrignore 2017-02-01 16:41:48 +0000
4@@ -31,7 +31,6 @@
5 doc/html
6 click-hooks/webapp-container-hook
7 click-hooks/webapp-container.hook
8-setup/gui/webbrowser-app.desktop
9
10 obj-*
11 debian/usr.bin.webbrowser-app
12
13=== modified file 'CMakeLists.txt'
14--- CMakeLists.txt 2016-10-10 16:50:59 +0000
15+++ CMakeLists.txt 2017-02-01 16:41:48 +0000
16@@ -62,14 +62,13 @@
17 add_subdirectory(tests)
18
19 # make non compiled files (QML, JS, images, etc.) visible in QtCreator
20-file(GLOB NON_COMPILED_ROOT *.png .bzrignore COPYING make-snap.sh README snapcraft.yaml)
21+file(GLOB NON_COMPILED_ROOT *.png .bzrignore COPYING README snapcraft.yaml)
22 file(GLOB_RECURSE NON_COMPILED_SUBDIRS
23 debian/*.dirs debian/*.install debian/*.lintian-overrides debian/*.manifest
24 debian/compat debian/control debian/copyright debian/rules debian/source/format
25 debian/tests/*
26 doc/*.css doc/*.qdoc doc/*.qdocconf
27 po/*.po po/*.pot
28- setup/gui/*.png setup/gui/webbrowser-app.desktop.in
29 snap/webbrowser-app.launcher
30 src/*.js src/*.qml src/*.sci src/README
31 tests/*.py tests/*.qml)
32
33=== removed file 'make-snap.sh'
34--- make-snap.sh 2016-10-06 10:16:41 +0000
35+++ make-snap.sh 1970-01-01 00:00:00 +0000
36@@ -1,4 +0,0 @@
37-#!/bin/sh
38-SNAP_DESKTOP_FILE=setup/gui/webbrowser-app.desktop
39-intltool-merge -d -u po $SNAP_DESKTOP_FILE.in $SNAP_DESKTOP_FILE
40-snapcraft
41
42=== removed directory 'setup'
43=== removed directory 'setup/gui'
44=== removed symlink 'setup/gui/icon.png'
45=== target was u'../../webbrowser-app.png'
46=== removed symlink 'setup/gui/screenshot.png'
47=== target was u'../../screenshot.png'
48=== removed file 'setup/gui/webbrowser-app.desktop.in'
49--- setup/gui/webbrowser-app.desktop.in 2016-10-06 13:08:19 +0000
50+++ setup/gui/webbrowser-app.desktop.in 1970-01-01 00:00:00 +0000
51@@ -1,27 +0,0 @@
52-[Desktop Entry]
53-Version=1.0
54-_Name=Browser
55-_GenericName=Web Browser
56-_Comment=Browse the World Wide Web
57-_Keywords=Internet;WWW;Browser;Web;Explorer
58-Type=Application
59-Icon=${SNAP}/meta/gui/icon.png
60-Exec=webbrowser-app %u
61-Terminal=false
62-Categories=Network;WebBrowser;
63-MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
64-X-Ubuntu-Touch=true
65-X-Ubuntu-Gettext-Domain=webbrowser-app
66-X-Ubuntu-Single-Instance=true
67-X-Ubuntu-Default-Department-ID=web-browsers
68-X-Screenshot=${SNAP}/meta/gui/screenshot.png
69-X-Ubuntu-Splash-Color=#FFFFFF
70-Actions=NewWindow;Incognito;
71-
72-[Desktop Action NewWindow]
73-_Name=Open a New Window
74-Exec=webbrowser-app --new-window
75-
76-[Desktop Action Incognito]
77-_Name=Open a New Private Window
78-Exec=webbrowser-app --incognito
79
80=== modified file 'snapcraft.yaml'
81--- snapcraft.yaml 2017-01-10 09:17:30 +0000
82+++ snapcraft.yaml 2017-02-01 16:41:48 +0000
83@@ -7,6 +7,7 @@
84 apps:
85 webbrowser-app:
86 command: webbrowser-app.launcher
87+ desktop: share/applications/webbrowser-app.desktop
88 plugs:
89 - browser-sandbox
90 - camera
91@@ -49,8 +50,10 @@
92 stage-packages:
93 - fonts-liberation
94 after: [desktop-ubuntu-app-platform]
95- snap:
96+ build-attributes: [no-system-libraries]
97+ prime:
98 - bin/webbrowser-app
99+ - share/applications/webbrowser-app.desktop
100 - share/content-hub/peers/webbrowser-app
101 - share/locale
102 - share/url-dispatcher/urls/webbrowser-app.url-dispatcher
103
104=== modified file 'src/Ubuntu/Web/ua-overrides-desktop.js.in'
105--- src/Ubuntu/Web/ua-overrides-desktop.js.in 2016-11-22 09:24:25 +0000
106+++ src/Ubuntu/Web/ua-overrides-desktop.js.in 2017-02-01 16:41:48 +0000
107@@ -1,5 +1,5 @@
108 /*
109- * Copyright 2014-2016 Canonical Ltd.
110+ * Copyright 2014-2017 Canonical Ltd.
111 *
112 * This file is part of webbrowser-app.
113 *
114@@ -18,28 +18,47 @@
115
116 .pragma library
117
118+// Note: when changing the value of this variable, all domains which
119+// use it must be carefully tested to ensure no regression.
120+var chrome_desktop_override = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/${CHROMIUM_VERSION} Chrome/${CHROMIUM_VERSION} Safari/537.36";
121+
122 var overrides = [
123- ["^https?:\/\/.+\.google\.com\/calendar", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chromium/${CHROMIUM_VERSION} Chrome/${CHROMIUM_VERSION} Safari/537.36"],
124- ["^http:\/\/chrome\.angrybirds\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"], // http://pad.lv/1284158
125- ["^https?:\/\/(www\.)?youtube\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"], // http://pad.lv/1412880
126- ["^https?:\/\/(www\.)?google\..+\/maps", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"], // http://pad.lv/1503506, http://pad.lv/1551649
127- ["^https?:\/\/mail\.google\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"], // http://pad.lv/1452616
128- ["^https?:\/\/mobile\.twitter\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"], // http://pad.lv/1577834
129-
130- // Google hangouts (https://launchpad.net/bugs/1565055)
131- ["^https?:\/\/hangouts\.google\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
132- ["^https?:\/\/talkgadget\.google\.com\/hangouts\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
133- ["^https?:\/\/plus\.google\.com\/hangouts\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
134-
135- // Google recaptcha (https://launchpad.net/bugs/1599146)
136- ["^https:\/\/www\.google\.com\/recaptcha\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
137-
138- // ESPN websites (https://launchpad.net/bugs/1637285)
139- ["^https?:\/\/(.+\.)?espn(fc)?\.co(m|\.uk)\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
140-
141- // meet.jit.si (https://launchpad.net/bugs/1635971)
142- ["^https:\/\/meet\.jit\.si\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
143-
144- // Google docs (https://launchpad.net/bugs/1643386)
145- ["^https:\/\/(docs|drive)\.google\.com\/", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
146+ // Google calendar
147+ ["^https:\/\/calendar\.google\.com\/", chrome_desktop_override],
148+ ["^https:\/\/.+\.google\.com\/calendar\/", chrome_desktop_override],
149+
150+ // Youtube (https://launchpad.net/bugs/1412880)
151+ ["^https:\/\/(www\.)?youtube\.com\/", chrome_desktop_override],
152+
153+ // Google maps (https://launchpad.net/bugs/1503506, https://launchpad.net/bugs/1551649)
154+ ["^https:\/\/(www\.)?google\..+\/maps", chrome_desktop_override],
155+
156+ // Gmail (https://launchpad.net/bugs/1452616)
157+ ["^https:\/\/mail\.google\.com\/", chrome_desktop_override],
158+
159+ // Google docs (https://launchpad.net/bugs/1643386)
160+ ["^https:\/\/(docs|drive)\.google\.com\/", chrome_desktop_override],
161+
162+ // Google plus (https://launchpad.net/bugs/1656310)
163+ ["^https:\/\/plus\.google\.com\/", chrome_desktop_override],
164+
165+ // Google hangouts (https://launchpad.net/bugs/1565055)
166+ ["^https:\/\/hangouts\.google\.com\/", chrome_desktop_override],
167+ ["^https:\/\/talkgadget\.google\.com\/hangouts\/", chrome_desktop_override],
168+ ["^https:\/\/plus\.google\.com\/hangouts\/", chrome_desktop_override],
169+
170+ // Google recaptcha (https://launchpad.net/bugs/1599146)
171+ ["^https:\/\/www\.google\.com\/recaptcha\/", chrome_desktop_override],
172+
173+ // (mobile) twitter (https://launchpad.net/bugs/1577834)
174+ ["^https:\/\/mobile\.twitter\.com\/", chrome_desktop_override],
175+
176+ // meet.jit.si (https://launchpad.net/bugs/1635971)
177+ ["^https:\/\/meet\.jit\.si\/", chrome_desktop_override],
178+
179+ // ESPN websites (https://launchpad.net/bugs/1637285)
180+ ["^https?:\/\/(.+\.)?espn(fc)?\.co(m|\.uk)\/", chrome_desktop_override],
181+
182+ // Ebay (https://launchpad.net/bugs/1575780)
183+ ["^https?:\/\/(.+\.)?ebay\.(at|be|ca|ch|cn|co\.jp|co\.th|co\.uk|com|com\.au|com\.hk|com\.my|com\.sg|com\.tw|de|es|fr|ie|in|it|nl|ph|pl|se|vn)\/", chrome_desktop_override],
184 ];
185
186=== modified file 'src/Ubuntu/Web/ua-overrides-mobile.js.in'
187--- src/Ubuntu/Web/ua-overrides-mobile.js.in 2016-10-27 17:18:23 +0000
188+++ src/Ubuntu/Web/ua-overrides-mobile.js.in 2017-02-01 16:41:48 +0000
189@@ -1,5 +1,5 @@
190 /*
191- * Copyright 2014-2016 Canonical Ltd.
192+ * Copyright 2014-2017 Canonical Ltd.
193 *
194 * This file is part of webbrowser-app.
195 *
196@@ -18,24 +18,46 @@
197
198 .pragma library
199
200+// Note: when changing the values of these variables, all domains which
201+// use them must be carefully tested to ensure no regression.
202+var android_no_device_override = "Mozilla/5.0 (Linux; Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
203+var nexus5_override = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
204+var ubuntu_like_android_override = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
205+var no_android_token = "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36";
206+
207 var overrides = [
208- ["^https?:\/\/mail\.google\.com\/", "Mozilla/5.0 (Linux; Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1375889
209- ["^https?:\/\/(www|m)\.youtube\.com\/", "Mozilla/5.0 (Linux; Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1228415, http://pad.lv/1415107, http://pad.lv/1417258, http://pad.lv/1499394, http://pad.lv/1408760, http://pad.lv/1437485
210- ["^http:\/\/chrome\.angrybirds\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1284158
211- ["^https?:\/\/(\w+\.)*hsbc\.com\.br\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1380657
212- ["^http:\/\/(\w+\.)*espn\.(go\.)?com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1316259
213- ["^https?:\/\/(www|m)\.facebook\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1538056, http://pad.lv/1457661
214- ["^https?:\/\/(mobile\.)?nytimes\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1573620
215- ["^https?:\/\/mobile\.twitter\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"], // http://pad.lv/1577834
216+ // Youtube (https://launchpad.net/bugs/1228415, https://launchpad.net/bugs/1415107, https://launchpad.net/bugs/1417258, https://launchpad.net/bugs/1499394, https://launchpad.net/bugs/1408760, https://launchpad.net/bugs/1437485)
217+ ["^https:\/\/(www|m)\.youtube\.com\/", android_no_device_override],
218+
219+ // Gmail (https://launchpad.net/bugs/1375889)
220+ ["^https:\/\/mail\.google\.com\/", android_no_device_override],
221+
222+ // Google plus (https://launchpad.net/bugs/1656310)
223+ ["^https:\/\/plus\.google\.com\/", ubuntu_like_android_override],
224
225 // Google hangouts (https://launchpad.net/bugs/1565055)
226- ["^https?:\/\/hangouts\.google\.com\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"],
227- ["^https?:\/\/talkgadget\.google\.com\/hangouts\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"],
228- ["^https?:\/\/plus\.google\.com\/hangouts\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Mobile Safari/537.36"],
229+ ["^https:\/\/hangouts\.google\.com\/", ubuntu_like_android_override],
230+ ["^https:\/\/talkgadget\.google\.com\/hangouts\/", ubuntu_like_android_override],
231+ ["^https:\/\/plus\.google\.com\/hangouts\/", ubuntu_like_android_override],
232
233 // Google recaptcha (https://launchpad.net/bugs/1599146)
234- ["^https:\/\/www\.google\.com\/recaptcha\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 4.4;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
235+ ["^https:\/\/www\.google\.com\/recaptcha\/", ubuntu_like_android_override],
236+
237+ // Facebook (https://launchpad.net/bugs/1538056, https://launchpad.net/bugs/1457661)
238+ ["^https:\/\/(www|m)\.facebook\.com\/", nexus5_override],
239+
240+ // Twitter (https://launchpad.net/bugs/1577834)
241+ ["^https:\/\/mobile\.twitter\.com\/", no_android_token],
242
243 // meet.jit.si (https://launchpad.net/bugs/1635971)
244- ["^https:\/\/meet\.jit\.si\/", "Mozilla/5.0 (Linux; Ubuntu @UBUNTU_VERSION@ like Android 5.0;) AppleWebKit/537.36 Chrome/${CHROMIUM_VERSION} Safari/537.36"],
245+ ["^https:\/\/meet\.jit\.si\/", ubuntu_like_android_override],
246+
247+ // ESPN websites (https://launchpad.net/bugs/1316259)
248+ ["^http:\/\/(\w+\.)*espn\.(go\.)?com\/", ubuntu_like_android_override],
249+
250+ // New York Times (https://launchpad.net/bugs/1573620)
251+ ["^https?:\/\/(mobile\.)?nytimes\.com\/", nexus5_override],
252+
253+ // appear.in (https://launchpad.net/bugs/1659288)
254+ ["^https:\/\/appear\.in\/", no_android_token],
255 ];
256
257=== modified file 'src/app/webbrowser/TabComponent.qml'
258--- src/app/webbrowser/TabComponent.qml 2016-11-25 15:49:50 +0000
259+++ src/app/webbrowser/TabComponent.qml 2017-02-01 16:41:48 +0000
260@@ -33,6 +33,7 @@
261 id: tabComponent
262
263 BrowserTab {
264+ id: browserTab
265 anchors.fill: parent
266 incognito: browser ? browser.incognito : false
267 current: browser ? browser.tabsModel && browser.tabsModel.currentTab === this : false
268@@ -253,9 +254,9 @@
269 contextMenu: browser && browser.wide ? contextMenuWideComponent : contextMenuNarrowComponent
270
271 onNewViewRequested: {
272- var tab = browser.createTab({"request": request})
273+ var newTab = browser.createTab({"request": request})
274 var setCurrent = (request.disposition == Oxide.NewViewRequest.DispositionNewForegroundTab)
275- internal.addTab(tab, setCurrent)
276+ internal.addTab(newTab, setCurrent, tabsModel.indexOf(browserTab) + 1)
277 if (setCurrent) tabContainer.forceActiveFocus()
278 }
279
280@@ -263,11 +264,9 @@
281 onPrepareToCloseResponse: {
282 if (proceed) {
283 if (tab) {
284- for (var i = 0; i < tabsModel.count; ++i) {
285- if (tabsModel.get(i) === tab) {
286- tabsModel.remove(i)
287- break
288- }
289+ var i = tabsModel.indexOf(tab);
290+ if (i != -1) {
291+ tabsModel.remove(i);
292 }
293
294 // tab.close() destroys the context so add new tab before destroy if required
295
296=== modified file 'src/app/webbrowser/tabs-model.cpp'
297--- src/app/webbrowser/tabs-model.cpp 2015-12-03 10:47:22 +0000
298+++ src/app/webbrowser/tabs-model.cpp 2017-02-01 16:41:48 +0000
299@@ -203,6 +203,15 @@
300 return m_tabs.at(index);
301 }
302
303+/*!
304+ Returns the index position of the first occurrence of tab in the model.
305+ Returns -1 if no item matched.
306+*/
307+int TabsModel::indexOf(QObject* tab) const
308+{
309+ return m_tabs.indexOf(tab);
310+}
311+
312 void TabsModel::move(int from, int to)
313 {
314 if ((from == to) || !checkValidTabIndex(from) || !checkValidTabIndex(to)) {
315
316=== modified file 'src/app/webbrowser/tabs-model.h'
317--- src/app/webbrowser/tabs-model.h 2015-09-02 16:37:20 +0000
318+++ src/app/webbrowser/tabs-model.h 2017-02-01 16:41:48 +0000
319@@ -60,6 +60,7 @@
320 Q_INVOKABLE int insert(QObject* tab, int index);
321 Q_INVOKABLE QObject* remove(int index);
322 Q_INVOKABLE QObject* get(int index) const;
323+ Q_INVOKABLE int indexOf(QObject* tab) const;
324 Q_INVOKABLE void move(int from, int to);
325
326 Q_SIGNALS:
327
328=== modified file 'tests/autopilot/webbrowser_app/tests/test_tabs.py'
329--- tests/autopilot/webbrowser_app/tests/test_tabs.py 2016-08-10 15:43:04 +0000
330+++ tests/autopilot/webbrowser_app/tests/test_tabs.py 2017-02-01 16:41:48 +0000
331@@ -222,6 +222,28 @@
332 self.assertThat(len(views), Equals(1))
333 self.check_current_tab(url)
334
335+ # http://pad.lv/1499780
336+ @testtools.skipIf(model() != "Desktop", "on desktop only")
337+ def test_ctrl_click_open_link_in_next_tab(self):
338+ self.open_new_tab()
339+ first_tab = self.main_window.chrome.get_tabs_bar().get_tab(0)
340+ self.pointing_device.click_object(first_tab)
341+
342+ url = self.base_url + "/link"
343+ self.main_window.go_to_url(url)
344+ self.main_window.wait_until_page_loaded(url)
345+ webview = self.main_window.get_current_webview()
346+
347+ self.keyboard.press('Ctrl')
348+ self.pointing_device.click_object(webview)
349+ self.keyboard.release('Ctrl')
350+
351+ # Eventually we should have three webviews
352+ self.assert_number_webviews_eventually(3)
353+ next_tab = self.main_window.chrome.get_tabs_bar().get_tab(1)
354+ self.pointing_device.click_object(next_tab)
355+ self.check_current_tab(self.url)
356+
357 def test_open_iframe_target_blank_in_new_tab(self):
358 url = self.base_url + "/fulliframewithblanktargetlink"
359 self.main_window.go_to_url(url)
360
361=== modified file 'tests/unittests/tabs-model/tst_TabsModelTests.cpp'
362--- tests/unittests/tabs-model/tst_TabsModelTests.cpp 2016-04-04 10:17:33 +0000
363+++ tests/unittests/tabs-model/tst_TabsModelTests.cpp 2017-02-01 16:41:48 +0000
364@@ -486,6 +486,18 @@
365 QCOMPARE(model->get(3), (QObject*) nullptr);
366 }
367
368+ void shouldReturnTabIndex()
369+ {
370+ QQuickItem* tab1 = createTab();
371+ model->add(tab1);
372+ QQuickItem* tab2 = createTab();
373+ model->add(tab2);
374+ QQuickItem* nonAddedTab = createTab();
375+ QCOMPARE(model->indexOf(tab1), 0);
376+ QCOMPARE(model->indexOf(tab2), 1);
377+ QCOMPARE(model->indexOf(nonAddedTab), -1);
378+ }
379+
380 private:
381 void moveTabs(int from, int to, bool moved, bool indexChanged, int newIndex)
382 {
383
384=== modified file 'webbrowser-app.png'
385Binary files webbrowser-app.png 2015-05-21 10:28:19 +0000 and webbrowser-app.png 2017-02-01 16:41:48 +0000 differ

Subscribers

People subscribed via source and target branches

to status/vote changes: