Merge lp:~hiroshidi/ubuntu-terminal-app/autopilot-header-and-settings into lp:ubuntu-terminal-app
- autopilot-header-and-settings
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Nicholas Skaggs |
Approved revision: | 23 |
Merged at revision: | 17 |
Proposed branch: | lp:~hiroshidi/ubuntu-terminal-app/autopilot-header-and-settings |
Merge into: | lp:ubuntu-terminal-app |
Diff against target: |
595 lines (+323/-85) 7 files modified
Configs.qml (+2/-0) config/JsConfig.qml (+1/-1) tests/autopilot/ubuntu_terminal_app/emulators/main_window.py (+88/-1) tests/autopilot/ubuntu_terminal_app/emulators/ubuntusdk.py (+57/-54) tests/autopilot/ubuntu_terminal_app/tests/__init__.py (+61/-2) tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py (+96/-19) ubuntu-terminal-app.qml (+18/-8) |
To merge this branch: | bzr merge lp:~hiroshidi/ubuntu-terminal-app/autopilot-header-and-settings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Ubuntu Terminal Developers | Pending | ||
Review via email: mp+172287@code.launchpad.net |
Commit message
Add more autopilot tests:
- test for font size
- test for color schemes
- test for Header shows/hides
Description of the change
Emulators and tests updated according to changes in UbuntuSDK
Added more autopilot tests:
- test for font size
- test for color schemes
- test for Header shows/hides
Fixes in the terminal app:
- ToolbarActions -> ToolbarItems
- added 'objectName' property for items
- added missing handling for height changing
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Nicholas Skaggs (nskaggs) wrote : | # |
We spoke about the sliders and the width issue. When I hear back on the orientation testing I'll let you know. On the sliders, I'm confused if there's a sdk issue here or not.
- 21. By Dmitry Zagnoyko
-
Updated test and emulators according to changes in UbuntuSDK API
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:21
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 22. By Dmitry Zagnoyko
-
Added some comment
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:22
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 23. By Dmitry Zagnoyko
-
comment out broken test
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:23
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'Configs.qml' |
2 | --- Configs.qml 2013-05-06 19:03:02 +0000 |
3 | +++ Configs.qml 2013-07-19 21:31:27 +0000 |
4 | @@ -33,6 +33,7 @@ |
5 | |
6 | ListItem.ValueSelector { |
7 | id: liSchemes |
8 | + objectName: "liSchemes" |
9 | width: parent.width |
10 | |
11 | function setValue(val) { |
12 | @@ -61,6 +62,7 @@ |
13 | |
14 | Slider{ |
15 | id: slFont |
16 | + objectName: "slFont" |
17 | anchors { |
18 | left: parent.left |
19 | leftMargin: units.gu(2) |
20 | |
21 | === modified file 'config/JsConfig.qml' |
22 | --- config/JsConfig.qml 2013-06-03 16:21:45 +0000 |
23 | +++ config/JsConfig.qml 2013-07-19 21:31:27 +0000 |
24 | @@ -24,7 +24,7 @@ |
25 | } |
26 | |
27 | function setFontSize(size){ |
28 | - dbEngine.setConfig("fontSize",size.toString() ); |
29 | + dbEngine.setConfig("fontSize", Math.round(size).toString() ); |
30 | } |
31 | |
32 | } |
33 | |
34 | === modified file 'tests/autopilot/ubuntu_terminal_app/emulators/main_window.py' |
35 | --- tests/autopilot/ubuntu_terminal_app/emulators/main_window.py 2013-06-19 18:51:53 +0000 |
36 | +++ tests/autopilot/ubuntu_terminal_app/emulators/main_window.py 2013-07-19 21:31:27 +0000 |
37 | @@ -14,8 +14,41 @@ |
38 | self.app = app |
39 | self.autopilot = autopilot |
40 | |
41 | - def click_popup_item(self, popupLable): |
42 | + def get_qml_view(self): |
43 | + """Get the main QML view""" |
44 | + return self.app.select_single("QQuickView") |
45 | + |
46 | + def get_header_item(self): |
47 | + """Get the header""" |
48 | + return self.app.select_single("Header") |
49 | + |
50 | + def get_slider_item(self, slider): |
51 | + """Get the header""" |
52 | + return self.app.select_single("Slider", objectName=slider) |
53 | + |
54 | + def expand_width(self, val): |
55 | + """Expand width of the main QML view""" |
56 | + qmlView = self.get_qml_view() |
57 | + startX = int(qmlView.x + qmlView.width) |
58 | + stopX = int(qmlView.x + qmlView.width + val) |
59 | + lineY = int(qmlView.height/2) |
60 | + self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
61 | + |
62 | + def expand_height(self, val): |
63 | + """Expand height of the main QML view""" |
64 | + qmlView = self.get_qml_view() |
65 | + startY = int(qmlView.y + qmlView.height) |
66 | + stopY = int(qmlView.y + qmlView.height + val) |
67 | + lineX = int(qmlView.width/2) |
68 | + self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) |
69 | + |
70 | + def click_action_selection_popup_item(self, popupLable): |
71 | """Clicks the toolbar popup item with popupLable""" |
72 | + # The action selection is assumed to be the following format |
73 | + # ActionSelectionPopover { |
74 | + # actions: ActionList { |
75 | + # Action { |
76 | + # text: |
77 | li = self.app.select_single("ActionSelectionPopover") |
78 | row = li.select_single("QQuickColumn") |
79 | loaderList = row.select_many("QQuickLoader") |
80 | @@ -25,3 +58,57 @@ |
81 | if label.text == popupLable: |
82 | self.autopilot.pointing_device.click_object(label) |
83 | |
84 | + def click_value_selector_item(self, selector, value): |
85 | + """Clicks value from value selector""" |
86 | + # The value selector is assumed to be the following format |
87 | + # ListItem.ValueSelector { |
88 | + # objectName: |
89 | + # values: |
90 | + val_selector = self.app.select_single("ValueSelector", objectName=selector) |
91 | + self.autopilot.pointing_device.click_object(val_selector) |
92 | + rows = val_selector.select_single("QQuickColumn") |
93 | + rects = rows.select_many("QQuickRectangle") |
94 | + for ritem in rects: |
95 | + labelList = ritem.select_many("LabelVisual") |
96 | + for label in labelList: |
97 | + if label.text == value: |
98 | + self.autopilot.pointing_device.click_object(label) |
99 | + |
100 | + def tap_horizontal_slider(self, slider, pos): |
101 | + """Tap slider at position""" |
102 | + slItem = self.get_slider_item(slider) |
103 | + x, y, w, h = slItem.globalRect |
104 | + |
105 | + # pos to click inside the slider, px |
106 | + self.autopilot.pointing_device.move(x+pos, y+(h/2)) |
107 | + self.autopilot.pointing_device.click() |
108 | + |
109 | + def drag_horizontal_slider(self, slider, pos): |
110 | + """Drag slider by delta value""" |
111 | + # The slider is assumed to be the following format |
112 | + # Slider { |
113 | + # objectName: |
114 | + # minimumValue: |
115 | + # maximumValue: |
116 | + slItem = self.get_slider_item(slider) |
117 | + slRect = slItem.select_single("SliderStyle") |
118 | + |
119 | + # calculate required shift per position |
120 | + thumbSpace = slRect.thumbSpace |
121 | + minVal = slItem.minimumValue |
122 | + maxVal = slItem.maximumValue |
123 | + shift = thumbSpace/(maxVal-minVal) |
124 | + |
125 | + # get thumb to drag |
126 | + ushapes = slItem.select_many("UbuntuShape") |
127 | + slThumb = ushapes[0] |
128 | + for ushape in ushapes: |
129 | + if ushape.width == slRect.thumbWidth: |
130 | + slThumb = ushape |
131 | + |
132 | + x, y, w, h = slThumb.globalRect |
133 | + sx = x+w/2 |
134 | + sy = y+h/2 |
135 | + self.autopilot.pointing_device.drag(sx, sy, sx+(shift*pos), sy) |
136 | + |
137 | + |
138 | |
139 | === modified file 'tests/autopilot/ubuntu_terminal_app/emulators/ubuntusdk.py' |
140 | --- tests/autopilot/ubuntu_terminal_app/emulators/ubuntusdk.py 2013-06-19 18:51:53 +0000 |
141 | +++ tests/autopilot/ubuntu_terminal_app/emulators/ubuntusdk.py 2013-07-19 21:31:27 +0000 |
142 | @@ -38,6 +38,10 @@ |
143 | """Get more than one object""" |
144 | return self.app.select_many(typeName, objectName=name) |
145 | |
146 | + def get_tabs(self): |
147 | + """Return all tabs""" |
148 | + return self.app.select_single("Tabs") |
149 | + |
150 | def switch_to_tab(self, tab): |
151 | """Switch to the specified tab number""" |
152 | tabs = self.get_tabs() |
153 | @@ -46,11 +50,37 @@ |
154 | #perform operations until tab == currentTab |
155 | while tab != currentTab: |
156 | if tab > currentTab: |
157 | + self._next_tab() |
158 | + if tab < currentTab: |
159 | self._previous_tab() |
160 | - if tab < currentTab: |
161 | - self._next_tab() |
162 | currentTab = tabs.selectedTabIndex |
163 | |
164 | + def _previous_tab(self): |
165 | + """Switch to the previous tab""" |
166 | + qmlView = self.get_qml_view() |
167 | + |
168 | + startX = int(qmlView.x + qmlView.width * 0.10) |
169 | + stopX = int(qmlView.x + qmlView.width * 0.45) |
170 | + lineY = int(qmlView.y + qmlView.height * 0.05) |
171 | + |
172 | + self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
173 | + self.autopilot.pointing_device.move(startX, lineY) |
174 | + self.autopilot.pointing_device.click() |
175 | + self.autopilot.pointing_device.click() |
176 | + |
177 | + def _next_tab(self): |
178 | + """Switch to the next tab""" |
179 | + qmlView = self.get_qml_view() |
180 | + |
181 | + startX = int(qmlView.x + qmlView.width * 0.45) |
182 | + stopX = int(qmlView.x + qmlView.width * 0.10) |
183 | + lineY = int(qmlView.y + qmlView.height * 0.05) |
184 | + |
185 | + self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
186 | + self.autopilot.pointing_device.move(startX, lineY) |
187 | + self.autopilot.pointing_device.click() |
188 | + self.autopilot.pointing_device.click() |
189 | + |
190 | def toggle_toolbar(self): |
191 | """Toggle the toolbar between revealed and hidden""" |
192 | #check and see if the toolbar is open or not |
193 | @@ -68,10 +98,10 @@ |
194 | toolbar = self.get_toolbar() |
195 | if not toolbar.opened: |
196 | self.open_toolbar() |
197 | - row = toolbar.select_single("QQuickRow") |
198 | + row = toolbar.select_single("ToolbarItems") |
199 | loaderList = row.select_many("QQuickLoader") |
200 | for loader in loaderList: |
201 | - buttonList = loader.select_many("Button") |
202 | + buttonList = loader.select_many("Label") |
203 | for button in buttonList: |
204 | if button.text == buttonLabel: |
205 | return button |
206 | @@ -79,10 +109,11 @@ |
207 | def click_toolbar_button(self, buttonLabel): |
208 | """Clicks the toolbar button with buttonLabel""" |
209 | #The toolbar button is assumed to be the following format |
210 | - #ToolbarActions { |
211 | - # Action { |
212 | - # objectName: "name" |
213 | - # text: value |
214 | + # ToolbarItems { |
215 | + # ToolbarButton { |
216 | + # id: |
217 | + # action: Action { |
218 | + # text: |
219 | button = self.get_toolbar_button(buttonLabel) |
220 | self.autopilot.pointing_device.click_object(button) |
221 | |
222 | @@ -90,9 +121,9 @@ |
223 | """Open the toolbar""" |
224 | qmlView = self.get_qml_view() |
225 | |
226 | - lineX = qmlView.x + qmlView.width * 0.50 |
227 | - startY = qmlView.y + qmlView.height - 1 |
228 | - stopY = qmlView.y + qmlView.height * 0.95 |
229 | + lineX = int(qmlView.x + qmlView.width * 0.50) |
230 | + startY = int(qmlView.y + qmlView.height - 1) |
231 | + stopY = int(qmlView.y + qmlView.height * 0.95) |
232 | |
233 | self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) |
234 | |
235 | @@ -100,9 +131,9 @@ |
236 | """Hide the toolbar""" |
237 | qmlView = self.get_qml_view() |
238 | |
239 | - lineX = qmlView.x + qmlView.width * 0.50 |
240 | - startY = qmlView.y + qmlView.height * 0.95 |
241 | - stopY = qmlView.y + qmlView.height - 1 |
242 | + lineX = int(qmlView.x + qmlView.width * 0.50) |
243 | + startY = int(qmlView.y + qmlView.height * 0.95) |
244 | + stopY = int(qmlView.y + qmlView.height - 1) |
245 | |
246 | self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) |
247 | |
248 | @@ -111,44 +142,16 @@ |
249 | At the moment this only works for values that are currently visible. To |
250 | access the remaining items, a help method to drag and recheck is needed.""" |
251 | #The popover is assumed to be the following format |
252 | - # Popover { |
253 | - # Column { |
254 | - # ListView { |
255 | - # delegate: Standard { |
256 | - # objectName: "name" |
257 | - # text: value |
258 | - |
259 | - self.autopilot.pointing_device.click_object(button) |
260 | - #we'll get all matching objects, incase the popover is reused between buttons |
261 | - itemList = lambda: self.get_objects("Standard", popover) |
262 | - |
263 | - for item in itemList(): |
264 | - if item.get_properties()['text'] == value: |
265 | + #Component { |
266 | + # id: actionSelectionPopover |
267 | + # |
268 | + #ActionSelectionPopover { |
269 | + # actions: ActionList { |
270 | + # Action { |
271 | + |
272 | + popList = self.get_object("ActionSelectionPopover", popover) |
273 | + itemList = popList.select_many("Label") |
274 | + for item in itemList: |
275 | + if item.text == value: |
276 | self.autopilot.pointing_device.click_object(item) |
277 | - |
278 | - def get_tabs(self): |
279 | - """Return all tabs""" |
280 | - return self.get_object("Tabs", "rootTabs") |
281 | - |
282 | - def _previous_tab(self): |
283 | - """Switch to the previous tab""" |
284 | - qmlView = self.get_qml_view() |
285 | - |
286 | - startX = qmlView.x + qmlView.width * 0.35 |
287 | - stopX = qmlView.x + qmlView.width * 0.50 |
288 | - lineY = qmlView.y + qmlView.height * 0.05 |
289 | - |
290 | - self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
291 | - self.autopilot.pointing_device.click() |
292 | - self.autopilot.pointing_device.click() |
293 | - |
294 | - def _next_tab(self): |
295 | - """Switch to the next tab""" |
296 | - qmlView = self.get_qml_view() |
297 | - |
298 | - startX = qmlView.x + qmlView.width * 0.50 |
299 | - stopX = qmlView.x + qmlView.width * 0.35 |
300 | - lineY = qmlView.y + qmlView.height * 0.05 |
301 | - |
302 | - self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) |
303 | - self.autopilot.pointing_device.click() |
304 | + return item |
305 | |
306 | === modified file 'tests/autopilot/ubuntu_terminal_app/tests/__init__.py' |
307 | --- tests/autopilot/ubuntu_terminal_app/tests/__init__.py 2013-06-19 18:51:53 +0000 |
308 | +++ tests/autopilot/ubuntu_terminal_app/tests/__init__.py 2013-07-19 21:31:27 +0000 |
309 | @@ -8,6 +8,7 @@ |
310 | """Terminal app autopilot tests.""" |
311 | |
312 | import os.path |
313 | +import sqlite3 |
314 | |
315 | from autopilot.input import Mouse, Touch, Pointer |
316 | from autopilot.platform import model |
317 | @@ -54,8 +55,66 @@ |
318 | @property |
319 | def main_window(self): |
320 | return MainWindow(self, self.app) |
321 | - |
322 | + |
323 | @property |
324 | def ubuntu_sdk(self): |
325 | return ubuntusdk(self, self.app) |
326 | - |
327 | + |
328 | + |
329 | +class DbMan(object): |
330 | + """ |
331 | + Helper functions for dealing with sqlite databases |
332 | + """ |
333 | + |
334 | + def get_db(self): |
335 | + dbs_path = os.path.expanduser("~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/Databases/") |
336 | + if not os.path.exists(dbs_path): |
337 | + return None |
338 | + |
339 | + files = [ f for f in os.listdir(dbs_path) if os.path.splitext(f)[1] == ".ini" ] |
340 | + for f in files: |
341 | + ini_path = os.path.join(dbs_path, f) |
342 | + with open(ini_path) as ini: |
343 | + for line in ini: |
344 | + if "=" in line: |
345 | + key, val = line.strip().split("=") |
346 | + if key == "Name" and val == "UbuntuTerminalDB": |
347 | + try: |
348 | + return ini_path.replace(".ini", ".sqlite") |
349 | + except OSError: |
350 | + pass |
351 | + return None |
352 | + |
353 | + def clean_db(self): |
354 | + path = self.get_db() |
355 | + if path is None: |
356 | + self.assertNotEquals(path, None) |
357 | + try: |
358 | + os.remove(path) |
359 | + except OSError: |
360 | + pass |
361 | + |
362 | + def get_font_size_from_storage(self): |
363 | + db = self.get_db() |
364 | + conn = sqlite3.connect(db) |
365 | + |
366 | + with conn: |
367 | + cur = conn.cursor() |
368 | + cur.execute("SELECT value FROM config WHERE item='fontSize'") |
369 | + row = cur.fetchone() |
370 | + if row is None: |
371 | + self.assertNotEquals(row, None) |
372 | + return int(row[0]) |
373 | + |
374 | + def get_color_scheme_from_storage(self): |
375 | + db = self.get_db() |
376 | + conn = sqlite3.connect(db) |
377 | + |
378 | + with conn: |
379 | + cur = conn.cursor() |
380 | + cur.execute("SELECT value FROM config WHERE item='colorScheme'") |
381 | + row = cur.fetchone() |
382 | + if row is None: |
383 | + self.assertNotEquals(row, None) |
384 | + return row[0] |
385 | + |
386 | |
387 | === modified file 'tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py' |
388 | --- tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2013-06-19 18:51:53 +0000 |
389 | +++ tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2013-07-19 21:31:27 +0000 |
390 | @@ -10,13 +10,13 @@ |
391 | from __future__ import absolute_import |
392 | |
393 | from autopilot.matchers import Eventually |
394 | -from testtools.matchers import Equals |
395 | +from testtools.matchers import Equals, GreaterThan |
396 | |
397 | -from ubuntu_terminal_app.tests import TerminalTestCase |
398 | +from ubuntu_terminal_app.tests import TerminalTestCase, DbMan |
399 | |
400 | import time |
401 | |
402 | -class TestMainWindow(TerminalTestCase): |
403 | +class TestMainWindow(TerminalTestCase, DbMan): |
404 | |
405 | def setUp(self): |
406 | super(TestMainWindow, self).setUp() |
407 | @@ -26,52 +26,129 @@ |
408 | def tearDown(self): |
409 | super(TestMainWindow, self).tearDown() |
410 | |
411 | - def test_Control_Panel_shows(self): |
412 | + def test_control_panel_shows(self): |
413 | """Make sure that Control Keys Panel is visible |
414 | when clicking the toolbar popup items.""" |
415 | self.ubuntu_sdk.click_toolbar_button("Panels") |
416 | - self.main_window.click_popup_item("Control keys") |
417 | + self.main_window.click_action_selection_popup_item("Control keys") |
418 | panelCtrl = self.ubuntu_sdk.get_object("CtrlKeys", "kbCtrl") |
419 | self.assertThat(panelCtrl.visible, Eventually(Equals(True))) |
420 | - |
421 | - def test_Function_Panel_shows(self): |
422 | + |
423 | + def test_function_panel_shows(self): |
424 | """Make sure that Function Keys Panel is visible |
425 | when clicking the toolbar popup items.""" |
426 | self.ubuntu_sdk.click_toolbar_button("Panels") |
427 | - self.main_window.click_popup_item("Function keys") |
428 | + self.main_window.click_action_selection_popup_item("Function keys") |
429 | panelFunc = self.ubuntu_sdk.get_object("FnKeys", "kbFn") |
430 | self.assertThat(panelFunc.visible, Eventually(Equals(True))) |
431 | - |
432 | + |
433 | def test_TextCtrl_Panel_shows(self): |
434 | """Make sure that Text Control Keys Panel is visible |
435 | when clicking the toolbar popup items.""" |
436 | self.ubuntu_sdk.click_toolbar_button("Panels") |
437 | - self.main_window.click_popup_item("Text ctrl keys") |
438 | + self.main_window.click_action_selection_popup_item("Text ctrl keys") |
439 | panelScrl = self.ubuntu_sdk.get_object("ScrlKeys", "kbScrl") |
440 | self.assertThat(panelScrl.visible, Eventually(Equals(True))) |
441 | - |
442 | - def test_Panels_hide(self): |
443 | + |
444 | + def test_panels_hide(self): |
445 | """Make sure that all panels are hide |
446 | when clicking the toolbar popup items.""" |
447 | self.ubuntu_sdk.click_toolbar_button("Panels") |
448 | - self.main_window.click_popup_item("Hide extra panel") |
449 | + self.main_window.click_action_selection_popup_item("Hide extra panel") |
450 | panelCtrl = self.ubuntu_sdk.get_object("CtrlKeys", "kbCtrl") |
451 | panelFunc = self.ubuntu_sdk.get_object("FnKeys", "kbFn") |
452 | panelScrl = self.ubuntu_sdk.get_object("ScrlKeys", "kbScrl") |
453 | self.assertThat(panelCtrl.visible, Eventually(Equals(False))) |
454 | self.assertThat(panelFunc.visible, Eventually(Equals(False))) |
455 | self.assertThat(panelScrl.visible, Eventually(Equals(False))) |
456 | - |
457 | - def test_CircleMenu_shows(self): |
458 | + |
459 | + def test_circle_menu_shows(self): |
460 | """Make sure that Circle Menu is visible |
461 | on long tap""" |
462 | - kterm = self.ubuntu_sdk.get_object("KTerminalDisplay", "kterm") |
463 | + kterm = self.ubuntu_sdk.get_object("Terminal", "pgTerm") |
464 | menu = self.ubuntu_sdk.get_object("CircleMenu", "cmenu") |
465 | self.pointing_device.click_object(kterm) |
466 | self.pointing_device.press() |
467 | time.sleep(1) |
468 | self.pointing_device.release() |
469 | self.assertThat(menu.visible, Eventually(Equals(True))) |
470 | - |
471 | - |
472 | - |
473 | + |
474 | + def test_header_shows(self): |
475 | + """Make sure that Header is visible |
476 | + in Portrait Mode""" |
477 | + qmlView = self.ubuntu_sdk.get_qml_view() |
478 | + header = self.main_window.get_header_item() |
479 | + self.main_window.expand_width(10) |
480 | + self.assertThat(qmlView.height, Eventually(GreaterThan(qmlView.width))) |
481 | + self.assertThat(header.visible, Eventually(Equals(True))) |
482 | + |
483 | + def test_header_hides(self): |
484 | + """Make sure that Header is not visible |
485 | + in Landscape Mode""" |
486 | + qmlView = self.ubuntu_sdk.get_qml_view() |
487 | + header = self.main_window.get_header_item() |
488 | + self.main_window.expand_width(400) |
489 | + self.assertThat(qmlView.width, Eventually(GreaterThan(qmlView.height))) |
490 | + self.assertThat(header.visible, Eventually(Equals(False))) |
491 | + |
492 | + |
493 | + # broken testcase. should be uncommented |
494 | + # and tested with latest update of ubuntu sdk |
495 | + |
496 | + #def test_color_scheme_changes(self): |
497 | + # """Make sure that color scheme is set correctly""" |
498 | + # qmlView = self.ubuntu_sdk.get_qml_view() |
499 | + # # kterm = self.ubuntu_sdk.get_object("KTerminalDisplay", "kterm") |
500 | + # self.ubuntu_sdk.switch_to_tab(1) |
501 | + |
502 | + # schemeList = ("DarkPastels", |
503 | + # "Linux", |
504 | + # "BlackOnRandomLight", |
505 | + # "BlackOnWhite", |
506 | + # "BlackOnLightYellow", |
507 | + # "GreenOnBlack", |
508 | + # "WhiteOnBlack", |
509 | + # ) |
510 | + |
511 | + # for scheme in schemeList: |
512 | + # self.main_window.click_value_selector_item("liSchemes",scheme) |
513 | + # # This assert uses KTerminalDisplay property (old rev) |
514 | + # # self.assertThat(kterm.colorScheme, Eventually(Equals(scheme))) |
515 | + # time.sleep(0.3) |
516 | + # # This assert uses localstorage (new rev) |
517 | + # colorScheme = self.get_color_scheme_from_storage() |
518 | + # self.assertThat(colorScheme, Equals(scheme)) |
519 | + |
520 | + |
521 | + def test_font_size_changes(self): |
522 | + """Make sure that font size is set correctly""" |
523 | + self.ubuntu_sdk.switch_to_tab(1) |
524 | + slider = self.main_window.get_slider_item("slFont") |
525 | + |
526 | + # start and end positions |
527 | + i = int(slider.minimumValue) + 1 |
528 | + iMax = int(slider.maximumValue) |
529 | + |
530 | + # return to start position of the slider |
531 | + self.main_window.tap_horizontal_slider("slFont",5) |
532 | + time.sleep(0.3) |
533 | + font_size = self.get_font_size_from_storage() |
534 | + self.assertThat(font_size, Equals(8)) |
535 | + |
536 | + p = 1 |
537 | + while ( i < (iMax+1) ): |
538 | + # WARNING - MAGIC nums: should be removed with better case |
539 | + if (i == 18): |
540 | + p = 1.4 |
541 | + if (i == 20): |
542 | + p = 1 |
543 | + |
544 | + self.main_window.drag_horizontal_slider("slFont",p) |
545 | + time.sleep(0.3) |
546 | + font_size = self.get_font_size_from_storage() |
547 | + self.assertThat(font_size, Equals(i)) |
548 | + i+=1 |
549 | + |
550 | + |
551 | + |
552 | + |
553 | |
554 | === modified file 'ubuntu-terminal-app.qml' |
555 | --- ubuntu-terminal-app.qml 2013-06-19 15:19:47 +0000 |
556 | +++ ubuntu-terminal-app.qml 2013-07-19 21:31:27 +0000 |
557 | @@ -40,6 +40,7 @@ |
558 | |
559 | Tabs { |
560 | id: tabs |
561 | + objectName: "rootTabs" |
562 | anchors.fill: parent |
563 | |
564 | Tab { |
565 | @@ -51,14 +52,23 @@ |
566 | header.visible = width < height; |
567 | } |
568 | |
569 | - Terminal { id: pgTerm } |
570 | - |
571 | - tools: ToolbarActions { |
572 | - Action { |
573 | - id: toolbarAction |
574 | - text: "Panels" |
575 | - iconSource: Qt.resolvedUrl("avatar.png") |
576 | - onTriggered: PopupUtils.open(actionSelectionPopover, caller) |
577 | + onHeightChanged: { |
578 | + header.visible = width < height; |
579 | + } |
580 | + |
581 | + Terminal { |
582 | + id: pgTerm |
583 | + objectName: "pgTerm" |
584 | + } |
585 | + |
586 | + tools: ToolbarItems { |
587 | + ToolbarButton { |
588 | + id: toolbarAction |
589 | + action: Action { |
590 | + text: "Panels" |
591 | + iconSource: Qt.resolvedUrl("avatar.png") |
592 | + onTriggered: PopupUtils.open(actionSelectionPopover, toolbarAction) |
593 | + } |
594 | } |
595 | } |
596 |
PASSED: Continuous integration, rev:20 91.189. 93.70:8080/ job/ubuntu- terminal- app-ci/ 1/ 91.189. 93.70:8080/ job/ubuntu- terminal- app-quantal- amd64-ci/ 1 91.189. 93.70:8080/ job/ubuntu- terminal- app-raring- amd64-ci/ 1
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- terminal- app-ci/ 1/rebuild
http://