Merge lp:~abreu-alexandre/ubuntu-html5-theme/rtm-content-picker-ui-fix into lp:ubuntu-html5-theme/rtm-14.09

Proposed by Alexandre Abreu
Status: Merged
Approved by: David Barth
Approved revision: 191
Merged at revision: 188
Proposed branch: lp:~abreu-alexandre/ubuntu-html5-theme/rtm-content-picker-ui-fix
Merge into: lp:ubuntu-html5-theme/rtm-14.09
Diff against target: 421 lines (+217/-122)
7 files modified
debian/control (+1/-0)
src/ubuntu-html5-app-launcher/UbuntuJavascriptBindings.qml (+0/-59)
src/ubuntu-html5-app-launcher/main.qml (+80/-57)
tests/autopilot/ubuntu_html5_container/tests/__init__.py (+10/-3)
tests/autopilot/ubuntu_html5_container/tests/test_appLaunch.py (+3/-3)
tests/autopilot/ubuntu_html5_container/tests/test_contentPickerLaunch.py (+57/-0)
tests/data/html/test-content-picker-launch/index.html (+66/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/ubuntu-html5-theme/rtm-content-picker-ui-fix
Reviewer Review Type Date Requested Status
Ubuntu HTML5 Theme Developers Pending
Review via email: mp+254644@code.launchpad.net

Commit message

re-parent the UnityWebappsBindings so that the content picker UI call can properly overlay the content

Description of the change

re-parent the UnityWebappsBindings so that the content picker UI call can properly overlay the content

To post a comment you must log in.
189. By Alexandre Abreu

remove old qml

190. By Alexandre Abreu

Add AP tests

191. By Alexandre Abreu

add content hub deps

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-03-06 15:00:25 +0000
+++ debian/control 2015-04-02 17:06:45 +0000
@@ -102,6 +102,7 @@
102 qml-module-qtwebkit,102 qml-module-qtwebkit,
103 qtdeclarative5-qtquick2-plugin,103 qtdeclarative5-qtquick2-plugin,
104 ubuntu-html5-container (>= ${binary:Version}),104 ubuntu-html5-container (>= ${binary:Version}),
105 qtdeclarative5-ubuntu-content1,
105 ${misc:Depends},106 ${misc:Depends},
106 ${python:Depends},107 ${python:Depends},
107Description: Autopilot tests for the Ubuntu HTML5 QML container component for HTML5 touch apps.108Description: Autopilot tests for the Ubuntu HTML5 QML container component for HTML5 touch apps.
108109
=== removed file 'src/ubuntu-html5-app-launcher/UbuntuJavascriptBindings.qml'
--- src/ubuntu-html5-app-launcher/UbuntuJavascriptBindings.qml 2015-02-12 18:07:26 +0000
+++ src/ubuntu-html5-app-launcher/UbuntuJavascriptBindings.qml 1970-01-01 00:00:00 +0000
@@ -1,59 +0,0 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This file is part of ubuntu-html5-container.
5 *
6 * ubuntu-html5-container 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
19import QtQuick 2.0
20import Ubuntu.UnityWebApps 0.1
21
22
23Item {
24 id: root
25
26 property var bindingMainWebview: null
27
28 /*!
29 \internal
30 */
31 function getUnityWebappsProxies() {
32 return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(bindingMainWebview);
33 }
34
35 /*!
36 \internal
37 */
38 Loader {
39 id: webappBindingsLoader
40 visible: false
41 anchors.fill: parent
42 sourceComponent: bindingMainWebview ? webappBindingsComponent : undefined
43 }
44
45 /*!
46 \internal
47 */
48 Component {
49 id: webappBindingsComponent
50
51 UnityWebApps {
52 id: webapps
53 bindee: root
54 injectExtraUbuntuApis: true
55 requiresInit: false
56 }
57 }
58}
59
600
=== modified file 'src/ubuntu-html5-app-launcher/main.qml'
--- src/ubuntu-html5-app-launcher/main.qml 2015-02-12 18:20:03 +0000
+++ src/ubuntu-html5-app-launcher/main.qml 2015-04-02 17:06:45 +0000
@@ -20,6 +20,7 @@
20import Ubuntu.Components 1.020import Ubuntu.Components 1.0
21import Ubuntu.Components.Extras.Browser 0.121import Ubuntu.Components.Extras.Browser 0.1
22import QtWebKit.experimental 1.022import QtWebKit.experimental 1.0
23import Ubuntu.UnityWebApps 0.1
2324
24MainView {25MainView {
25 id: root26 id: root
@@ -30,66 +31,88 @@
30 anchorToKeyboard: true31 anchorToKeyboard: true
31 automaticOrientation: true32 automaticOrientation: true
3233
33 Timer {
34 id: checkTimer
35 running: true
36 repeat: false
37 onTriggered: {
38 webviewComponentLoader.sourceComponent =
39 webviewComponent
40 checkTimer.stop()
41 }
42 interval: 100
43 }
44
45 Page {34 Page {
46 anchors.fill: parent35 id: page
36
37 title: ""
38
39 Timer {
40 id: checkTimer
41 running: true
42 repeat: false
43 onTriggered: {
44 webviewComponentLoader.sourceComponent = webviewComponent
45 checkTimer.stop()
46 }
47 interval: 100
48 }
49
47 Loader {50 Loader {
48 id: webviewComponentLoader51 id: webviewComponentLoader
49 anchors.fill: parent52 anchors.fill: parent
50 onLoaded: {53 onLoaded: webappsComponentLoader.sourceComponent = webappsComponent
51 bindings.bindingMainWebview =54 }
52 webviewComponentLoader.item;55
53 }56 Component {
54 }57 id: webviewComponent
55 }58
5659 UbuntuWebView {
57 Component {60 objectName: 'webview'
58 id: webviewComponent61 maximumFlickVelocity: height * 5
5962
60 UbuntuWebView {63 experimental.preferences.localStorageEnabled: true
61 maximumFlickVelocity: height * 564 experimental.preferences.offlineWebApplicationCacheEnabled: true
6265 experimental.preferences.universalAccessFromFileURLsAllowed: true
63 url: HtmlIndexDirectory !== "" ? ('file://' + HtmlIndexDirectory + '/index.html') : ""66 experimental.preferences.webGLEnabled: true
6467
65 experimental.preferences.localStorageEnabled: true68 experimental.databaseQuotaDialog: Item {
66 experimental.preferences.offlineWebApplicationCacheEnabled: true69 Timer {
67 experimental.preferences.universalAccessFromFileURLsAllowed: true70 interval: 1
68 experimental.preferences.webGLEnabled: true71 running: true
6972 onTriggered: {
70 experimental.databaseQuotaDialog: Item {73 model.accept(model.expectedUsage)
71 Timer {74 }
72 interval: 175 }
73 running: true76 }
74 onTriggered: {77
75 model.accept(model.expectedUsage)78 // port in QTWEBKIT_INSPECTOR_SERVER enviroment variable
76 }79 experimental.preferences.developerExtrasEnabled: true
77 }80
78 }81 onNewTabRequested: {
7982 if (url.toString().indexOf("file://") !== 0) {
80 // port in QTWEBKIT_INSPECTOR_SERVER enviroment variable83 Qt.openUrlExternally(url.toString())
81 experimental.preferences.developerExtrasEnabled: true84 return
8285 }
83 onNewTabRequested: {86 }
84 if (url.toString().indexOf("file://") !== 0) {87 }
85 Qt.openUrlExternally(url.toString())88 }
86 return89
87 }90 function getUnityWebappsProxies() {
88 }91 return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(
89 }92 webviewComponentLoader.item);
90 }93 }
9194
92 UbuntuJavascriptBindings {95 Loader {
93 id: bindings96 id: webappsComponentLoader
97 anchors.fill: parent
98 onLoaded: webviewComponentLoader.sourceComponent = webviewComponent
99 }
100
101 Component {
102 id: webappsComponent
103
104 UnityWebApps {
105 id: webapps
106 bindee: page
107 injectExtraUbuntuApis: true
108 requiresInit: false
109
110 Component.onCompleted: {
111 webviewComponentLoader.item.url =
112 HtmlIndexDirectory !== "" ?
113 ('file://' + HtmlIndexDirectory + '/index.html') : ""
114 }
115 }
116 }
94 }117 }
95}118}
96119
=== modified file 'tests/autopilot/ubuntu_html5_container/tests/__init__.py'
--- tests/autopilot/ubuntu_html5_container/tests/__init__.py 2014-12-08 18:08:39 +0000
+++ tests/autopilot/ubuntu_html5_container/tests/__init__.py 2015-04-02 17:06:45 +0000
@@ -12,8 +12,11 @@
1212
13LAUNCHER_EXEC_NAME = 'ubuntu-html5-app-launcher'13LAUNCHER_EXEC_NAME = 'ubuntu-html5-app-launcher'
1414
15LOCAL_LAUNCHER_PATH = os.path.abspath("%s/%s" % (os.path.dirname(os.path.realpath(__file__))15LOCAL_LAUNCHER_PATH = os.path.abspath(
16 , '../../../../src/ubuntu-html5-app-launcher/' + LAUNCHER_EXEC_NAME))16 "%s/%s" % (
17 os.path.dirname(
18 os.path.realpath(__file__))
19 , '../../../../src/ubuntu-html5-app-launcher/' + LAUNCHER_EXEC_NAME))
17INSTALLED_LAUNCHER_PATH = '/usr/bin/' + LAUNCHER_EXEC_NAME20INSTALLED_LAUNCHER_PATH = '/usr/bin/' + LAUNCHER_EXEC_NAME
1821
1922
@@ -35,7 +38,11 @@
3538
36 def launch_with_argument(self, args):39 def launch_with_argument(self, args):
37 try:40 try:
38 self.app = self.launch_test_application(self.get_launcher_path(), args)41 self.app = self.launch_test_application(
42 self.get_launcher_path(),
43 args,
44 app_type='qt')
39 except Exception, e:45 except Exception, e:
46 print e
40 pass47 pass
4148
4249
=== modified file 'tests/autopilot/ubuntu_html5_container/tests/test_appLaunch.py'
--- tests/autopilot/ubuntu_html5_container/tests/test_appLaunch.py 2014-12-08 18:08:39 +0000
+++ tests/autopilot/ubuntu_html5_container/tests/test_appLaunch.py 2015-04-02 17:06:45 +0000
@@ -7,7 +7,7 @@
77
8from __future__ import absolute_import8from __future__ import absolute_import
99
10from testtools.matchers import Equals10from testtools.matchers import Equals, NotEquals
1111
12from ubuntu_html5_container.tests import UbuntuHtml5LauncherTestCase12from ubuntu_html5_container.tests import UbuntuHtml5LauncherTestCase
1313
@@ -16,7 +16,7 @@
16 def setUp(self):16 def setUp(self):
17 super(UbuntuHtml5LauncherAppLaunchTestCase, self).setUp()17 super(UbuntuHtml5LauncherAppLaunchTestCase, self).setUp()
1818
19 def test_launcherFailsWithNoWWW(self):19 def test_launcherSucceedsWithNoWWW(self):
20 self.launch_with_argument('')20 self.launch_with_argument('')
21 self.assertThat(self.get_app(), Equals(None))21 self.assertThat(self.get_app(), NotEquals(None))
2222
2323
=== added file 'tests/autopilot/ubuntu_html5_container/tests/test_contentPickerLaunch.py'
--- tests/autopilot/ubuntu_html5_container/tests/test_contentPickerLaunch.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_html5_container/tests/test_contentPickerLaunch.py 2015-04-02 17:06:45 +0000
@@ -0,0 +1,57 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2014 Canonical
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU Lesser General Public License version 3, as published
6# by the Free Software Foundation.
7
8from __future__ import absolute_import
9
10import os
11
12from testtools.matchers import Equals, NotEquals
13from autopilot.matchers import Eventually
14
15from ubuntu_html5_container.tests import UbuntuHtml5LauncherTestCase
16import ubuntuuitoolkit as uitk
17
18LOCAL_HTML_EXAMPLES_PATH = os.path.abspath(
19 "%s/%s" % (
20 os.path.dirname(
21 os.path.realpath(__file__)),
22 '../../../../tests'))
23INSTALLED_HTML_EXAMPLES_PATH = '/usr/share/ubuntu-html5-ui-toolkit/tests/'
24
25
26class UbuntuHtml5LauncherAppLaunchTestCase(UbuntuHtml5LauncherTestCase):
27 def setUp(self):
28 self.pointing_device = uitk.get_pointing_device()
29 super(UbuntuHtml5LauncherAppLaunchTestCase, self).setUp()
30
31 def get_webviewContainer(self):
32 return self.app.select_single(objectName="webview")
33
34 def get_base_path(self):
35 if os.path.exists(LOCAL_HTML_EXAMPLES_PATH):
36 return LOCAL_HTML_EXAMPLES_PATH
37 else:
38 return INSTALLED_HTML_EXAMPLES_PATH
39
40 def get_local_html_url(self, html_filename):
41 return self.get_base_path() + '/data/html/' + html_filename
42
43 def test_contentPickerIsLaunched(self):
44 print self.get_local_html_url('test-content-picker-launch')
45 self.launch_with_argument(
46 '--www=' + self.get_local_html_url('test-content-picker-launch'))
47 self.assertThat(self.get_app(), NotEquals(None))
48 self.assertThat(
49 lambda: self.get_webviewContainer(),
50 Eventually(NotEquals(None)))
51 self.pointing_device.click_object(
52 self.get_webviewContainer())
53 self.assertThat(
54 lambda: len(self.get_app().select_many(
55 'ContentPeerPicker10')),
56 Eventually(NotEquals(0)))
57
058
=== added directory 'tests/data/html/test-content-picker-launch'
=== added file 'tests/data/html/test-content-picker-launch/index.html'
--- tests/data/html/test-content-picker-launch/index.html 1970-01-01 00:00:00 +0000
+++ tests/data/html/test-content-picker-launch/index.html 2015-04-02 17:06:45 +0000
@@ -0,0 +1,66 @@
1<!--
2 Copyright (C) 2013 Adnane Belmadiaf <daker@ubuntu.com>
3
4 This file is part of ubuntu-html5-ui-toolkit.
5
6 This package is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 3 of the
9 License, or
10 (at your option) any later version.
11
12 This package is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this program. If not, see
19 <http://www.gnu.org/licenses/>.
20-->
21
22<!DOCTYPE html>
23<html>
24<head>
25 <meta charset="utf-8" />
26 <meta name="copyright" content="Adnane Belmadiaf <daker@ubuntu.com>">
27 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
28 <title>Ubuntu UI HTML5: Application Template</title>
29
30 <script>
31
32 window.onload = function () {
33 document.addEventListener('click', doContentPeerPicking);
34
35 function doContentPeerPicking() {
36 var api = external.getUnityObject('1.0');
37 var hub = api.ContentHub;
38
39 var transferState = hub.ContentTransfer.State;
40 var pictureContentType = hub.ContentType.Pictures;
41document.getElementById('result').innerHTML = 'hub.launchContentPeerPicker'
42 hub.launchContentPeerPicker(
43 {
44 contentType: hub.ContentType.Pictures,
45 handler: hub.ContentHandler.Source,
46 },
47 function(peer) { },
48 function() { }
49 );
50 };
51 };
52 </script>
53
54</head>
55
56<body>
57<div style="height: 100%; width: 100%">
58 <div>
59 Start Content Peer picking to import content:
60 </div>
61 <div id="result">
62 </div>
63</div>
64</body>
65
66</html>

Subscribers

People subscribed via source and target branches