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 on 2015-03-30

remove old qml

190. By Alexandre Abreu on 2015-04-01

Add AP tests

191. By Alexandre Abreu on 2015-04-02

add content hub deps

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-03-06 15:00:25 +0000
3+++ debian/control 2015-04-02 17:06:45 +0000
4@@ -102,6 +102,7 @@
5 qml-module-qtwebkit,
6 qtdeclarative5-qtquick2-plugin,
7 ubuntu-html5-container (>= ${binary:Version}),
8+ qtdeclarative5-ubuntu-content1,
9 ${misc:Depends},
10 ${python:Depends},
11 Description: Autopilot tests for the Ubuntu HTML5 QML container component for HTML5 touch apps.
12
13=== removed file 'src/ubuntu-html5-app-launcher/UbuntuJavascriptBindings.qml'
14--- src/ubuntu-html5-app-launcher/UbuntuJavascriptBindings.qml 2015-02-12 18:07:26 +0000
15+++ src/ubuntu-html5-app-launcher/UbuntuJavascriptBindings.qml 1970-01-01 00:00:00 +0000
16@@ -1,59 +0,0 @@
17-/*
18- * Copyright 2014 Canonical Ltd.
19- *
20- * This file is part of ubuntu-html5-container.
21- *
22- * ubuntu-html5-container is free software; you can redistribute it and/or modify
23- * it under the terms of the GNU General Public License as published by
24- * the Free Software Foundation; version 3.
25- *
26- * webbrowser-app is distributed in the hope that it will be useful,
27- * but WITHOUT ANY WARRANTY; without even the implied warranty of
28- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29- * GNU General Public License for more details.
30- *
31- * You should have received a copy of the GNU General Public License
32- * along with this program. If not, see <http://www.gnu.org/licenses/>.
33- */
34-
35-import QtQuick 2.0
36-import Ubuntu.UnityWebApps 0.1
37-
38-
39-Item {
40- id: root
41-
42- property var bindingMainWebview: null
43-
44- /*!
45- \internal
46- */
47- function getUnityWebappsProxies() {
48- return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(bindingMainWebview);
49- }
50-
51- /*!
52- \internal
53- */
54- Loader {
55- id: webappBindingsLoader
56- visible: false
57- anchors.fill: parent
58- sourceComponent: bindingMainWebview ? webappBindingsComponent : undefined
59- }
60-
61- /*!
62- \internal
63- */
64- Component {
65- id: webappBindingsComponent
66-
67- UnityWebApps {
68- id: webapps
69- bindee: root
70- injectExtraUbuntuApis: true
71- requiresInit: false
72- }
73- }
74-}
75-
76
77=== modified file 'src/ubuntu-html5-app-launcher/main.qml'
78--- src/ubuntu-html5-app-launcher/main.qml 2015-02-12 18:20:03 +0000
79+++ src/ubuntu-html5-app-launcher/main.qml 2015-04-02 17:06:45 +0000
80@@ -20,6 +20,7 @@
81 import Ubuntu.Components 1.0
82 import Ubuntu.Components.Extras.Browser 0.1
83 import QtWebKit.experimental 1.0
84+import Ubuntu.UnityWebApps 0.1
85
86 MainView {
87 id: root
88@@ -30,66 +31,88 @@
89 anchorToKeyboard: true
90 automaticOrientation: true
91
92- Timer {
93- id: checkTimer
94- running: true
95- repeat: false
96- onTriggered: {
97- webviewComponentLoader.sourceComponent =
98- webviewComponent
99- checkTimer.stop()
100- }
101- interval: 100
102- }
103-
104 Page {
105- anchors.fill: parent
106+ id: page
107+
108+ title: ""
109+
110+ Timer {
111+ id: checkTimer
112+ running: true
113+ repeat: false
114+ onTriggered: {
115+ webviewComponentLoader.sourceComponent = webviewComponent
116+ checkTimer.stop()
117+ }
118+ interval: 100
119+ }
120+
121 Loader {
122 id: webviewComponentLoader
123 anchors.fill: parent
124- onLoaded: {
125- bindings.bindingMainWebview =
126- webviewComponentLoader.item;
127- }
128- }
129- }
130-
131- Component {
132- id: webviewComponent
133-
134- UbuntuWebView {
135- maximumFlickVelocity: height * 5
136-
137- url: HtmlIndexDirectory !== "" ? ('file://' + HtmlIndexDirectory + '/index.html') : ""
138-
139- experimental.preferences.localStorageEnabled: true
140- experimental.preferences.offlineWebApplicationCacheEnabled: true
141- experimental.preferences.universalAccessFromFileURLsAllowed: true
142- experimental.preferences.webGLEnabled: true
143-
144- experimental.databaseQuotaDialog: Item {
145- Timer {
146- interval: 1
147- running: true
148- onTriggered: {
149- model.accept(model.expectedUsage)
150- }
151- }
152- }
153-
154- // port in QTWEBKIT_INSPECTOR_SERVER enviroment variable
155- experimental.preferences.developerExtrasEnabled: true
156-
157- onNewTabRequested: {
158- if (url.toString().indexOf("file://") !== 0) {
159- Qt.openUrlExternally(url.toString())
160- return
161- }
162- }
163- }
164- }
165-
166- UbuntuJavascriptBindings {
167- id: bindings
168+ onLoaded: webappsComponentLoader.sourceComponent = webappsComponent
169+ }
170+
171+ Component {
172+ id: webviewComponent
173+
174+ UbuntuWebView {
175+ objectName: 'webview'
176+ maximumFlickVelocity: height * 5
177+
178+ experimental.preferences.localStorageEnabled: true
179+ experimental.preferences.offlineWebApplicationCacheEnabled: true
180+ experimental.preferences.universalAccessFromFileURLsAllowed: true
181+ experimental.preferences.webGLEnabled: true
182+
183+ experimental.databaseQuotaDialog: Item {
184+ Timer {
185+ interval: 1
186+ running: true
187+ onTriggered: {
188+ model.accept(model.expectedUsage)
189+ }
190+ }
191+ }
192+
193+ // port in QTWEBKIT_INSPECTOR_SERVER enviroment variable
194+ experimental.preferences.developerExtrasEnabled: true
195+
196+ onNewTabRequested: {
197+ if (url.toString().indexOf("file://") !== 0) {
198+ Qt.openUrlExternally(url.toString())
199+ return
200+ }
201+ }
202+ }
203+ }
204+
205+ function getUnityWebappsProxies() {
206+ return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(
207+ webviewComponentLoader.item);
208+ }
209+
210+ Loader {
211+ id: webappsComponentLoader
212+ anchors.fill: parent
213+ onLoaded: webviewComponentLoader.sourceComponent = webviewComponent
214+ }
215+
216+ Component {
217+ id: webappsComponent
218+
219+ UnityWebApps {
220+ id: webapps
221+ bindee: page
222+ injectExtraUbuntuApis: true
223+ requiresInit: false
224+
225+ Component.onCompleted: {
226+ webviewComponentLoader.item.url =
227+ HtmlIndexDirectory !== "" ?
228+ ('file://' + HtmlIndexDirectory + '/index.html') : ""
229+ }
230+ }
231+ }
232 }
233 }
234
235=== modified file 'tests/autopilot/ubuntu_html5_container/tests/__init__.py'
236--- tests/autopilot/ubuntu_html5_container/tests/__init__.py 2014-12-08 18:08:39 +0000
237+++ tests/autopilot/ubuntu_html5_container/tests/__init__.py 2015-04-02 17:06:45 +0000
238@@ -12,8 +12,11 @@
239
240 LAUNCHER_EXEC_NAME = 'ubuntu-html5-app-launcher'
241
242-LOCAL_LAUNCHER_PATH = os.path.abspath("%s/%s" % (os.path.dirname(os.path.realpath(__file__))
243- , '../../../../src/ubuntu-html5-app-launcher/' + LAUNCHER_EXEC_NAME))
244+LOCAL_LAUNCHER_PATH = os.path.abspath(
245+ "%s/%s" % (
246+ os.path.dirname(
247+ os.path.realpath(__file__))
248+ , '../../../../src/ubuntu-html5-app-launcher/' + LAUNCHER_EXEC_NAME))
249 INSTALLED_LAUNCHER_PATH = '/usr/bin/' + LAUNCHER_EXEC_NAME
250
251
252@@ -35,7 +38,11 @@
253
254 def launch_with_argument(self, args):
255 try:
256- self.app = self.launch_test_application(self.get_launcher_path(), args)
257+ self.app = self.launch_test_application(
258+ self.get_launcher_path(),
259+ args,
260+ app_type='qt')
261 except Exception, e:
262+ print e
263 pass
264
265
266=== modified file 'tests/autopilot/ubuntu_html5_container/tests/test_appLaunch.py'
267--- tests/autopilot/ubuntu_html5_container/tests/test_appLaunch.py 2014-12-08 18:08:39 +0000
268+++ tests/autopilot/ubuntu_html5_container/tests/test_appLaunch.py 2015-04-02 17:06:45 +0000
269@@ -7,7 +7,7 @@
270
271 from __future__ import absolute_import
272
273-from testtools.matchers import Equals
274+from testtools.matchers import Equals, NotEquals
275
276 from ubuntu_html5_container.tests import UbuntuHtml5LauncherTestCase
277
278@@ -16,7 +16,7 @@
279 def setUp(self):
280 super(UbuntuHtml5LauncherAppLaunchTestCase, self).setUp()
281
282- def test_launcherFailsWithNoWWW(self):
283+ def test_launcherSucceedsWithNoWWW(self):
284 self.launch_with_argument('')
285- self.assertThat(self.get_app(), Equals(None))
286+ self.assertThat(self.get_app(), NotEquals(None))
287
288
289=== added file 'tests/autopilot/ubuntu_html5_container/tests/test_contentPickerLaunch.py'
290--- tests/autopilot/ubuntu_html5_container/tests/test_contentPickerLaunch.py 1970-01-01 00:00:00 +0000
291+++ tests/autopilot/ubuntu_html5_container/tests/test_contentPickerLaunch.py 2015-04-02 17:06:45 +0000
292@@ -0,0 +1,57 @@
293+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
294+# Copyright 2014 Canonical
295+#
296+# This program is free software: you can redistribute it and/or modify it
297+# under the terms of the GNU Lesser General Public License version 3, as published
298+# by the Free Software Foundation.
299+
300+from __future__ import absolute_import
301+
302+import os
303+
304+from testtools.matchers import Equals, NotEquals
305+from autopilot.matchers import Eventually
306+
307+from ubuntu_html5_container.tests import UbuntuHtml5LauncherTestCase
308+import ubuntuuitoolkit as uitk
309+
310+LOCAL_HTML_EXAMPLES_PATH = os.path.abspath(
311+ "%s/%s" % (
312+ os.path.dirname(
313+ os.path.realpath(__file__)),
314+ '../../../../tests'))
315+INSTALLED_HTML_EXAMPLES_PATH = '/usr/share/ubuntu-html5-ui-toolkit/tests/'
316+
317+
318+class UbuntuHtml5LauncherAppLaunchTestCase(UbuntuHtml5LauncherTestCase):
319+ def setUp(self):
320+ self.pointing_device = uitk.get_pointing_device()
321+ super(UbuntuHtml5LauncherAppLaunchTestCase, self).setUp()
322+
323+ def get_webviewContainer(self):
324+ return self.app.select_single(objectName="webview")
325+
326+ def get_base_path(self):
327+ if os.path.exists(LOCAL_HTML_EXAMPLES_PATH):
328+ return LOCAL_HTML_EXAMPLES_PATH
329+ else:
330+ return INSTALLED_HTML_EXAMPLES_PATH
331+
332+ def get_local_html_url(self, html_filename):
333+ return self.get_base_path() + '/data/html/' + html_filename
334+
335+ def test_contentPickerIsLaunched(self):
336+ print self.get_local_html_url('test-content-picker-launch')
337+ self.launch_with_argument(
338+ '--www=' + self.get_local_html_url('test-content-picker-launch'))
339+ self.assertThat(self.get_app(), NotEquals(None))
340+ self.assertThat(
341+ lambda: self.get_webviewContainer(),
342+ Eventually(NotEquals(None)))
343+ self.pointing_device.click_object(
344+ self.get_webviewContainer())
345+ self.assertThat(
346+ lambda: len(self.get_app().select_many(
347+ 'ContentPeerPicker10')),
348+ Eventually(NotEquals(0)))
349+
350
351=== added directory 'tests/data/html/test-content-picker-launch'
352=== added file 'tests/data/html/test-content-picker-launch/index.html'
353--- tests/data/html/test-content-picker-launch/index.html 1970-01-01 00:00:00 +0000
354+++ tests/data/html/test-content-picker-launch/index.html 2015-04-02 17:06:45 +0000
355@@ -0,0 +1,66 @@
356+<!--
357+ Copyright (C) 2013 Adnane Belmadiaf <daker@ubuntu.com>
358+
359+ This file is part of ubuntu-html5-ui-toolkit.
360+
361+ This package is free software; you can redistribute it and/or modify
362+ it under the terms of the GNU Lesser General Public License as
363+ published by the Free Software Foundation; either version 3 of the
364+ License, or
365+ (at your option) any later version.
366+
367+ This package is distributed in the hope that it will be useful,
368+ but WITHOUT ANY WARRANTY; without even the implied warranty of
369+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
370+ GNU General Public License for more details.
371+
372+ You should have received a copy of the GNU Lesser General Public
373+ License along with this program. If not, see
374+ <http://www.gnu.org/licenses/>.
375+-->
376+
377+<!DOCTYPE html>
378+<html>
379+<head>
380+ <meta charset="utf-8" />
381+ <meta name="copyright" content="Adnane Belmadiaf <daker@ubuntu.com>">
382+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
383+ <title>Ubuntu UI HTML5: Application Template</title>
384+
385+ <script>
386+
387+ window.onload = function () {
388+ document.addEventListener('click', doContentPeerPicking);
389+
390+ function doContentPeerPicking() {
391+ var api = external.getUnityObject('1.0');
392+ var hub = api.ContentHub;
393+
394+ var transferState = hub.ContentTransfer.State;
395+ var pictureContentType = hub.ContentType.Pictures;
396+document.getElementById('result').innerHTML = 'hub.launchContentPeerPicker'
397+ hub.launchContentPeerPicker(
398+ {
399+ contentType: hub.ContentType.Pictures,
400+ handler: hub.ContentHandler.Source,
401+ },
402+ function(peer) { },
403+ function() { }
404+ );
405+ };
406+ };
407+ </script>
408+
409+</head>
410+
411+<body>
412+<div style="height: 100%; width: 100%">
413+ <div>
414+ Start Content Peer picking to import content:
415+ </div>
416+ <div id="result">
417+ </div>
418+</div>
419+</body>
420+
421+</html>

Subscribers

People subscribed via source and target branches