Merge lp:~osomon/webbrowser-app/zoomFactor into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: 1472
Proposed branch: lp:~osomon/webbrowser-app/zoomFactor
Merge into: lp:webbrowser-app
Diff against target: 146 lines (+86/-3)
3 files modified
debian/control (+1/-1)
src/app/webbrowser/Browser.qml (+36/-1)
tests/autopilot/webbrowser_app/tests/test_keyboard.py (+49/-1)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/zoomFactor
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+292637@code.launchpad.net

Commit message

Keyboard shortcuts for zoom factor:
 - Ctrl+Plus: zoom in
 - Ctrl+Minus: zoom out
 - Ctrl+0: reset zoom factor to 100%

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
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1429
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/462/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/464/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/464
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/463
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/463
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/470
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/470/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/470/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/470
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/470/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/470
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/470/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/470
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/470/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/470
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/470/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/462/rebuild

review: Needs Fixing (continuous-integration)
lp:~osomon/webbrowser-app/zoomFactor updated
1430. By Olivier Tilloy

Merge the latest changes from trunk and resolve a minor conflict.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~osomon/webbrowser-app/zoomFactor updated
1431. By Olivier Tilloy

Merge the latest changes from trunk and resolve a couple of minor conflicts.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2016-05-19 18:39:19 +0000
+++ debian/control 2016-05-23 15:50:35 +0000
@@ -45,7 +45,7 @@
45Depends: ${misc:Depends},45Depends: ${misc:Depends},
46 ${shlibs:Depends},46 ${shlibs:Depends},
47 fonts-liberation,47 fonts-liberation,
48 liboxideqt-qmlplugin (>= 1.12),48 liboxideqt-qmlplugin (>= 1.15),
49 libqt5sql5-sqlite,49 libqt5sql5-sqlite,
50 qml-module-qt-labs-folderlistmodel,50 qml-module-qt-labs-folderlistmodel,
51 qml-module-qt-labs-settings,51 qml-module-qt-labs-settings,
5252
=== modified file 'src/app/webbrowser/Browser.qml'
--- src/app/webbrowser/Browser.qml 2016-05-19 18:39:30 +0000
+++ src/app/webbrowser/Browser.qml 2016-05-23 15:50:35 +0000
@@ -19,7 +19,7 @@
19import QtQuick 2.419import QtQuick 2.4
20import QtQuick.Window 2.220import QtQuick.Window 2.2
21import Qt.labs.settings 1.021import Qt.labs.settings 1.0
22import com.canonical.Oxide 1.12 as Oxide22import com.canonical.Oxide 1.15 as Oxide
23import Ubuntu.Components 1.323import Ubuntu.Components 1.3
24import Ubuntu.Components.Popups 1.324import Ubuntu.Components.Popups 1.3
25import Unity.InputInfo 0.125import Unity.InputInfo 0.1
@@ -1457,6 +1457,18 @@
1457 readonly property bool hasMouse: (miceModel.count + touchPadModel.count) > 01457 readonly property bool hasMouse: (miceModel.count + touchPadModel.count) > 0
1458 readonly property bool hasTouchScreen: touchScreenModel.count > 01458 readonly property bool hasTouchScreen: touchScreenModel.count > 0
14591459
1460 // Ref: https://code.google.com/p/chromium/codesearch#chromium/src/components/ui/zoom/page_zoom_constants.cc
1461 readonly property var zoomFactors: [0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1.0,
1462 1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0]
1463 function changeZoomFactor(offset) {
1464 for (var i = 0; i < zoomFactors.length; ++i) {
1465 if (Math.abs(zoomFactors[i] - currentWebview.zoomFactor) <= 0.001) {
1466 currentWebview.zoomFactor = zoomFactors[i + offset]
1467 return
1468 }
1469 }
1470 }
1471
1460 function getOpenPages() {1472 function getOpenPages() {
1461 var urls = []1473 var urls = []
1462 for (var i = 0; i < tabsModel.count; i++) {1474 for (var i = 0; i < tabsModel.count; i++) {
@@ -2114,6 +2126,29 @@
2114 onActivated: currentWebview.findController.previous()2126 onActivated: currentWebview.findController.previous()
2115 }2127 }
21162128
2129 // Ctrl+Plus: zoom in
2130 Shortcut {
2131 sequence: StandardKey.ZoomIn
2132 enabled: currentWebview &&
2133 ((currentWebview.maximumZoomFactor - currentWebview.zoomFactor) > 0.001)
2134 onActivated: internal.changeZoomFactor(1)
2135 }
2136
2137 // Ctrl+Minus: zoom out
2138 Shortcut {
2139 sequence: StandardKey.ZoomOut
2140 enabled: currentWebview &&
2141 ((currentWebview.zoomFactor - currentWebview.minimumZoomFactor) > 0.001)
2142 onActivated: internal.changeZoomFactor(-1)
2143 }
2144
2145 // Ctrl+0: reset zoom factor to 1.0
2146 Shortcut {
2147 sequence: "Ctrl+0"
2148 enabled: currentWebview && (currentWebview.zoomFactor != 1.0)
2149 onActivated: currentWebview.zoomFactor = 1.0
2150 }
2151
2117 Loader {2152 Loader {
2118 id: contentHandlerLoader2153 id: contentHandlerLoader
2119 source: "../ContentHandler.qml"2154 source: "../ContentHandler.qml"
21202155
=== modified file 'tests/autopilot/webbrowser_app/tests/test_keyboard.py'
--- tests/autopilot/webbrowser_app/tests/test_keyboard.py 2016-05-05 10:09:48 +0000
+++ tests/autopilot/webbrowser_app/tests/test_keyboard.py 2016-05-23 15:50:35 +0000
@@ -19,7 +19,7 @@
19import time19import time
20import testtools20import testtools
2121
22from testtools.matchers import Equals, NotEquals, GreaterThan22from testtools.matchers import Equals, Mismatch, NotEquals, GreaterThan
23from autopilot.matchers import Eventually23from autopilot.matchers import Eventually
24from autopilot.platform import model24from autopilot.platform import model
2525
@@ -57,6 +57,19 @@
57 connection.close()57 connection.close()
5858
5959
60class AlmostEquals(object):
61
62 def __init__(self, expected):
63 self.expected = expected
64
65 def match(self, actual):
66 if round(actual - self.expected, 3) == 0:
67 return None
68 else:
69 msg = "{} is not almost equal to {}"
70 return Mismatch(msg.format(actual, self.expected))
71
72
60@testtools.skipIf(model() != "Desktop", "on desktop only")73@testtools.skipIf(model() != "Desktop", "on desktop only")
61class TestKeyboard(PrepopulatedDatabaseTestCaseBase):74class TestKeyboard(PrepopulatedDatabaseTestCaseBase):
6275
@@ -524,3 +537,38 @@
524 self.main_window.press_key('Ctrl+t')537 self.main_window.press_key('Ctrl+t')
525 self.address_bar.activeFocus.wait_for(True)538 self.address_bar.activeFocus.wait_for(True)
526 self.assertThat(self.address_bar.text, Eventually(Equals("")))539 self.assertThat(self.address_bar.text, Eventually(Equals("")))
540
541 def test_zoom_in_and_out(self):
542 webview = self.main_window.get_current_webview()
543 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(1.0)))
544
545 zooms = [1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0]
546 for zoom in zooms:
547 self.main_window.press_key('Ctrl+plus')
548 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(zoom)))
549
550 self.main_window.press_key('Ctrl+0')
551 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(1.0)))
552
553 zooms = [0.9, 0.75, 0.666, 0.5, 0.333, 0.25]
554 for zoom in zooms:
555 self.main_window.press_key('Ctrl+minus')
556 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(zoom)))
557
558 self.main_window.press_key('Ctrl+0')
559 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(1.0)))
560
561 def test_zoom_affects_domain(self):
562 webview = self.main_window.get_current_webview()
563 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(1.0)))
564
565 self.open_tabs(1)
566 self.check_tab_number(1)
567 self.main_window.press_key('Ctrl+plus')
568 webview = self.main_window.get_current_webview()
569 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(1.1)))
570
571 self.main_window.press_key('Ctrl+Tab')
572 self.check_tab_number(0)
573 webview = self.main_window.get_current_webview()
574 self.assertThat(webview.zoomFactor, Eventually(AlmostEquals(1.1)))

Subscribers

People subscribed via source and target branches

to status/vote changes: