Merge lp:~chocanto/ubuntu-docviewer-app/autopilot-testCases into lp:ubuntu-docviewer-app/trunk

Proposed by Anthony Granger
Status: Merged
Approved by: Anthony Granger
Approved revision: 17
Merged at revision: 13
Proposed branch: lp:~chocanto/ubuntu-docviewer-app/autopilot-testCases
Merge into: lp:ubuntu-docviewer-app/trunk
Prerequisite: lp:~chocanto/ubuntu-docviewer-app/autopilot-tests
Diff against target: 138 lines (+66/-16)
4 files modified
ImageView.qml (+1/-0)
TextView.qml (+10/-9)
tests/autopilot/ubuntu_docviewer_app/tests/test_docviewer.py (+54/-7)
ubuntu-docviewer-app.qml (+1/-0)
To merge this branch: bzr merge lp:~chocanto/ubuntu-docviewer-app/autopilot-testCases
Reviewer Review Type Date Requested Status
Anthony Granger Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+172177@code.launchpad.net

Commit message

A simple testcase to check if docviewer can open a plain text file.

Description of the change

A simple testcase to check if docviewer can open a plain text file.

To post a comment you must log in.
16. By Anthony Granger

Added a testcase to read mimetype of a text file

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
17. By Anthony Granger

Add testcases for opening an image and read image meta-data

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Anthony Granger (chocanto) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ImageView.qml'
2--- ImageView.qml 2013-04-25 16:43:54 +0000
3+++ ImageView.qml 2013-06-30 15:13:26 +0000
4@@ -9,6 +9,7 @@
5
6 Image{
7 id: image
8+ objectName: "imageItem"
9
10 source: file.getPath()
11 smooth: true
12
13=== modified file 'TextView.qml'
14--- TextView.qml 2013-04-25 16:33:39 +0000
15+++ TextView.qml 2013-06-30 15:13:26 +0000
16@@ -10,21 +10,22 @@
17
18
19 Column {
20- id: columnMain;
21- width: parent.width;
22+ id: columnMain
23+ objectName: "columnMain"
24+ width: parent.width
25 spacing: 10
26
27 TextArea {
28-
29- id: textAreaMain;
30-
31- width: parent.width;
32-
33- autoSize: true;
34+ id: textAreaMain
35+ objectName: "textAreaMain"
36+
37+ width: parent.width
38+
39+ autoSize: true
40 maximumLineCount: 0
41 readOnly: true
42 //activeFocusOnPress: false;
43- highlighted: true;
44+ highlighted: true
45
46 text: "Loading..."
47
48
49=== added file 'tests/autopilot/ubuntu_docviewer_app/files/ubuntu-touch.jpg'
50Binary files tests/autopilot/ubuntu_docviewer_app/files/ubuntu-touch.jpg 1970-01-01 00:00:00 +0000 and tests/autopilot/ubuntu_docviewer_app/files/ubuntu-touch.jpg 2013-06-30 15:13:26 +0000 differ
51=== modified file 'tests/autopilot/ubuntu_docviewer_app/tests/test_docviewer.py'
52--- tests/autopilot/ubuntu_docviewer_app/tests/test_docviewer.py 2013-06-30 15:13:26 +0000
53+++ tests/autopilot/ubuntu_docviewer_app/tests/test_docviewer.py 2013-06-30 15:13:26 +0000
54@@ -9,8 +9,10 @@
55
56 from __future__ import absolute_import
57
58+from pprint import pprint
59+
60 from autopilot.matchers import Eventually
61-from testtools.matchers import Equals
62+from testtools.matchers import Equals, NotEquals
63
64 from ubuntu_docviewer_app.tests import DocviewerTestCase
65
66@@ -29,9 +31,54 @@
67
68 self.launch_test_local(filePath)
69
70- self.assertThat(
71- self.ubuntusdk.get_qml_view().visible, Eventually(Equals(True)))
72-
73- #verify textbox is no longer empty
74- # or
75- #verify the file size displayed is not 0 (maybe easier ?)
76+ #Check if the app is correclty launched
77+ self.assertThat(
78+ self.ubuntusdk.get_qml_view().visible, Eventually(Equals(True)))
79+
80+ textArea = self.ubuntusdk.get_object("TextArea", "textAreaMain")
81+
82+ #Check if textarea is no longer empty
83+ self.assertThat(
84+ textArea.text, Eventually(NotEquals(False)))
85+
86+ def test_read_text_file_mimeType(self):
87+ filePath = 'ubuntu_docviewer_app/files/plaintext.txt'
88+
89+ self.launch_test_local(filePath)
90+
91+ self.check_mimeType()
92+
93+ def test_open_image_file(self):
94+
95+ filePath = 'ubuntu_docviewer_app/files/ubuntu-touch.jpg'
96+
97+ self.launch_test_local(filePath)
98+
99+ #Check if the app is correclty launched
100+ self.assertThat(
101+ self.ubuntusdk.get_qml_view().visible, Eventually(Equals(True)))
102+
103+ imageItem = self.ubuntusdk.get_object("QQuickImage", "imageItem")
104+
105+ #Check if status of Image is "Ready"
106+ self.assertThat(
107+ imageItem.status, Eventually(Equals(1)))
108+
109+ def test_read_image_file_mimeType(self):
110+ filePath = 'ubuntu_docviewer_app/files/ubuntu-touch.jpg'
111+
112+ self.launch_test_local(filePath)
113+ self.check_mimeType()
114+
115+
116+ def check_mimeType(self):
117+ mimetypeItem = self.ubuntusdk.get_object("SingleValue", "mimetypeItem")
118+
119+ self.assertThat(
120+ mimetypeItem.value, Eventually(NotEquals(False)))
121+
122+
123+
124+
125+
126+
127
128=== modified file 'ubuntu-docviewer-app.qml'
129--- ubuntu-docviewer-app.qml 2013-04-25 16:33:39 +0000
130+++ ubuntu-docviewer-app.qml 2013-06-30 15:13:26 +0000
131@@ -69,6 +69,7 @@
132
133 ListItem.SingleValue {
134 id: mimetypeItem
135+ objectName: "mimetypeItem"
136 text: i18n.tr("Mimetype")
137 value: file.getMimetype()
138 }

Subscribers

People subscribed via source and target branches