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

Proposed by Sergio Cazzolato on 2015-05-13
Status: Work in progress
Proposed branch: lp:~canonical-platform-qa/ubuntu-ui-toolkit/combobutton-tests
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 120 lines (+79/-2)
2 files modified
examples/ubuntu-ui-toolkit-gallery/Buttons.qml (+5/-2)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_combobuttons.py (+74/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/combobutton-tests
Reviewer Review Type Date Requested Status
Christian Dywan Needs Fixing on 2015-07-06
Christopher Lee (community) 2015-05-13 Approve on 2015-05-18
PS Jenkins bot continuous-integration Needs Fixing on 2015-05-15
Vincent Ladeuil (community) Needs Fixing on 2015-05-15
Sergio Cazzolato Pending
Leo Arias 2015-05-13 Pending
Review via email: mp+259054@code.launchpad.net

Commit Message

Test cases added to cover the ComboButton object

To post a comment you must log in.
Christopher Lee (veebers) wrote :

As per inline comments I think the tests should be split out into individual tests and the scenario removed.

review: Needs Fixing
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1189. By Sergio Cazzolato on 2015-05-14

Test cases added to cover the ComboButton object

Christopher Lee (veebers) wrote :

One minor comment, but otherwise looks great :-)

review: Needs Fixing
Vincent Ladeuil (vila) wrote :

One minor comment, but otherwise looks great :-)

Err, yeah, well, I agree with Chris but my minor comment is different ;)

review: Needs Fixing
1190. By Sergio Cazzolato on 2015-05-15

Test cases added to cover the ComboButton object

Christopher Lee (veebers) wrote :

Good catch @vila.

LGTM.

review: Approve
Christian Dywan (kalikiana) wrote :
review: Needs Fixing

Unmerged revisions

1190. By Sergio Cazzolato on 2015-05-15

Test cases added to cover the ComboButton object

1189. By Sergio Cazzolato on 2015-05-14

Test cases added to cover the ComboButton object

1188. By Sergio Cazzolato on 2015-05-13

Basic combobutton test cases

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/ubuntu-ui-toolkit-gallery/Buttons.qml'
2--- examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2015-03-03 13:47:48 +0000
3+++ examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2015-05-15 20:09:53 +0000
4@@ -100,7 +100,7 @@
5
6 ComboButton {
7 text: "Press me"
8- objectName: "combobutton_collapsed"
9+ objectName: "collapsed"
10 comboList: UbuntuListView {
11 model: 10
12 delegate: Standard {
13@@ -115,6 +115,7 @@
14
15 ComboButton {
16 iconSource: "call.png"
17+ objectName: "collapsed_icon"
18 comboList: UbuntuListView {
19 model: 10
20 delegate: Standard {
21@@ -129,6 +130,7 @@
22
23 ComboButton {
24 text: "Answer"
25+ objectName: "collapsed_icon_and_text"
26 iconSource: "call.png"
27 comboList: UbuntuListView {
28 model: 10
29@@ -143,10 +145,11 @@
30
31 ComboButton {
32 text: "Press me"
33- objectName: "combobutton_expanded"
34+ objectName: "expanded"
35 expanded: true
36 comboList: UbuntuListView {
37 model: 10
38+ objectName: "expanded_list"
39 delegate: Standard {
40 text: "item #" + modelData
41 }
42
43=== added file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_combobuttons.py'
44--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_combobuttons.py 1970-01-01 00:00:00 +0000
45+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_combobuttons.py 2015-05-15 20:09:53 +0000
46@@ -0,0 +1,74 @@
47+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
48+#
49+# Copyright (C) 2012, 2013, 2014, 2015 Canonical Ltd.
50+#
51+# This program is free software; you can redistribute it and/or modify
52+# it under the terms of the GNU Lesser General Public License as published by
53+# the Free Software Foundation; version 3.
54+#
55+# This program is distributed in the hope that it will be useful,
56+# but WITHOUT ANY WARRANTY; without even the implied warranty of
57+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+# GNU Lesser General Public License for more details.
59+#
60+# You should have received a copy of the GNU Lesser General Public License
61+# along with this program. If not, see <http://www.gnu.org/licenses/>.
62+
63+"""Tests for the Ubuntu UI Toolkit Gallery - ComboButton component"""
64+
65+import testscenarios
66+
67+from fixtures import EnvironmentVariable
68+
69+from ubuntuuitoolkit.tests import gallery
70+from ubuntuuitoolkit import ubuntu_scenarios
71+
72+
73+class ComboButtonsTestCase(gallery.GalleryTestCase):
74+
75+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
76+
77+ def setUp(self):
78+ super().setUp()
79+ self.useFixture(EnvironmentVariable('LANGUAGE', 'en'))
80+
81+ def test_collapsed_combo_button_has_text(self):
82+ self.open_page('buttonsElement')
83+
84+ combo_button = self.app.select_single('ComboButton', objectName='collapsed')
85+
86+ self.assertIsNot(combo_button, None)
87+ self.assertEquals('Press me', combo_button.text)
88+ self.assertFalse(combo_button.expanded)
89+
90+ def test_collapsed_combo_button_has_icon(self):
91+ self.open_page('buttonsElement')
92+
93+ combo_button = self.app.select_single('ComboButton', objectName='collapsed_icon')
94+
95+ self.assertIsNot(combo_button, None)
96+ self.assertTrue(combo_button.iconSource.endswith('call.png'))
97+ self.assertFalse(combo_button.expanded)
98+
99+ def test_collapsed_combo_button_has_icon_and_text(self):
100+ self.open_page('buttonsElement')
101+
102+ combo_button = self.app.select_single('ComboButton', objectName='collapsed_icon_and_text')
103+
104+ self.assertIsNot(combo_button, None)
105+ self.assertTrue(combo_button.iconSource.endswith('call.png'))
106+ self.assertEquals('Answer', combo_button.text)
107+ self.assertFalse(combo_button.expanded)
108+
109+ def test_expanded_combo_button_has_text_and_correct_size(self):
110+ self.open_page('buttonsElement')
111+
112+ combo_button = self.app.select_single('ComboButton', objectName='expanded')
113+ self.assertIsNot(combo_button, None)
114+ self.assertEquals('Press me', combo_button.text)
115+ self.assertTrue(combo_button.expanded)
116+ self.assertEquals(combo_button.expandedHeight, combo_button.height)
117+
118+ combo_list = self.app.select_single(objectName='expanded_list')
119+ self.assertIsNot(combo_list, None)
120+ self.assertEquals(10, combo_list.count)

Subscribers

People subscribed via source and target branches

to status/vote changes: