Merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/add_helpers_for_TextArea into lp:ubuntu-ui-toolkit

Proposed by Omer Akram
Status: Superseded
Proposed branch: lp:~canonical-platform-qa/ubuntu-ui-toolkit/add_helpers_for_TextArea
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 127 lines (+82/-0)
4 files modified
tests/autopilot/ubuntuuitoolkit/__init__.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py (+27/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py (+51/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/add_helpers_for_TextArea
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Canonical Platform QA Team Pending
Ubuntu SDK team Pending
Review via email: mp+228385@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-28.

Commit message

Add helper methods for TextArea

Description of the change

Add helper methods for TextArea

Note: there is a separate 'clear' method because the one that exists in TextField class checks the property hasClearButton which TextArea does not have.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/__init__.py'
2--- tests/autopilot/ubuntuuitoolkit/__init__.py 2014-07-07 14:43:52 +0000
3+++ tests/autopilot/ubuntuuitoolkit/__init__.py 2014-07-28 16:23:21 +0000
4@@ -38,6 +38,7 @@
5 'TabBar',
6 'Tabs',
7 'tests',
8+ 'TextArea',
9 'TextField',
10 'Toolbar',
11 'ToolkitException',
12@@ -71,6 +72,7 @@
13 QQuickListView,
14 TabBar,
15 Tabs,
16+ TextArea,
17 TextField,
18 Toolbar,
19 ToolkitException,
20
21=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py'
22--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2014-06-30 10:49:51 +0000
23+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2014-07-28 16:23:21 +0000
24@@ -33,6 +33,7 @@
25 'QQuickListView',
26 'TabBar',
27 'Tabs',
28+ 'TextArea',
29 'TextField',
30 'Toolbar',
31 'ToolkitException',
32@@ -65,6 +66,7 @@
33 )
34 from ubuntuuitoolkit._custom_proxy_objects._tabbar import TabBar
35 from ubuntuuitoolkit._custom_proxy_objects._tabs import Tabs
36+from ubuntuuitoolkit._custom_proxy_objects._textarea import TextArea
37 from ubuntuuitoolkit._custom_proxy_objects._textfield import TextField
38 from ubuntuuitoolkit._custom_proxy_objects._toolbar import Toolbar
39 from ubuntuuitoolkit._custom_proxy_objects._ubuntulistview import (
40
41=== added file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py'
42--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py 1970-01-01 00:00:00 +0000
43+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textarea.py 2014-07-28 16:23:21 +0000
44@@ -0,0 +1,27 @@
45+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
46+#
47+# Copyright (C) 2014 Canonical Ltd.
48+#
49+# This program is free software; you can redistribute it and/or modify
50+# it under the terms of the GNU Lesser General Public License as published by
51+# the Free Software Foundation; version 3.
52+#
53+# This program is distributed in the hope that it will be useful,
54+# but WITHOUT ANY WARRANTY; without even the implied warranty of
55+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+# GNU Lesser General Public License for more details.
57+#
58+# You should have received a copy of the GNU Lesser General Public License
59+# along with this program. If not, see <http://www.gnu.org/licenses/>.
60+
61+from ubuntuuitoolkit._custom_proxy_objects import _textfield
62+
63+
64+class TextArea(_textfield.TextField):
65+ """TextArea autopilot emulator."""
66+
67+ def clear(self):
68+ """Clear the text area."""
69+ if not self.is_empty():
70+ self._clear_with_keys()
71+ self.text.wait_for('')
72
73=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py'
74--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 1970-01-01 00:00:00 +0000
75+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textarea.py 2014-07-28 16:23:21 +0000
76@@ -0,0 +1,51 @@
77+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
78+#
79+# Copyright (C) 2014 Canonical Ltd.
80+#
81+# This program is free software; you can redistribute it and/or modify
82+# it under the terms of the GNU Lesser General Public License as published by
83+# the Free Software Foundation; version 3.
84+#
85+# This program is distributed in the hope that it will be useful,
86+# but WITHOUT ANY WARRANTY; without even the implied warranty of
87+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88+# GNU Lesser General Public License for more details.
89+#
90+# You should have received a copy of the GNU Lesser General Public License
91+# along with this program. If not, see <http://www.gnu.org/licenses/>.
92+
93+import ubuntuuitoolkit
94+from ubuntuuitoolkit import tests
95+
96+
97+class TextAreaTestCase(tests.QMLStringAppTestCase):
98+
99+ test_qml = ("""
100+import QtQuick 2.0
101+import Ubuntu.Components 0.1
102+
103+MainView {
104+ width: units.gu(48)
105+ height: units.gu(60)
106+
107+ Item {
108+ TextArea {
109+ objectName: "simple_text_area"
110+ }
111+ }
112+}
113+""")
114+
115+ def setUp(self):
116+ super(TextAreaTestCase, self).setUp()
117+ self.simple_text_area = self.main_view.select_single(
118+ ubuntuuitoolkit.TextArea, objectName='simple_text_area')
119+
120+ def test_text_area_inherits_text_field(self):
121+ self.assertTrue(
122+ issubclass(ubuntuuitoolkit.TextArea, ubuntuuitoolkit.TextField))
123+
124+ def test_clear(self):
125+ self.simple_text_area.write('test')
126+ self.simple_text_area.clear()
127+ self.assertEqual(self.simple_text_area.text, '')

Subscribers

People subscribed via source and target branches

to status/vote changes: