Merge lp:~aacid/unity-2d/unity-2d_test_launcher_resize_on_desktop_resize into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 867
Merged at revision: 866
Proposed branch: lp:~aacid/unity-2d/unity-2d_test_launcher_resize_on_desktop_resize
Merge into: lp:unity-2d
Diff against target: 108 lines (+104/-0)
1 file modified
tests/launcher/launcher_sizing.rb (+104/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d_test_launcher_resize_on_desktop_resize
Reviewer Review Type Date Requested Status
Gerry Boland (community) Needs Fixing
Michał Sawicz Needs Information
Review via email: mp+89726@code.launchpad.net

Description of the change

[test] Check the launcher moves and resizes correctly when the available desktop space changes (e.g. panel goes away)

To post a comment you must log in.
862. By Albert Astals Cid

It's me not Gerry

Revision history for this message
Michał Sawicz (saviq) wrote :

could we maybe use SUT to launch the panel? otherwise we get log output from the panel in the console where you're running tests

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

Michał: Done

863. By Albert Astals Cid

Use sut to start the panel so no output goes to the shell

864. By Albert Astals Cid

merge

865. By Albert Astals Cid

Adapt to new split testabilty commands

Revision history for this message
Gerry Boland (gerboland) wrote :

+ verify_equal( old_height + PANEL_HEIGHT, TIMEOUT, "Launcher did not move to the top of the screen when killing the panel" ) {

Comment is wrong, but except for that everything looks good.

review: Needs Fixing
866. By Albert Astals Cid

Fix comment as spotted by Gerry

Revision history for this message
Albert Astals Cid (aacid) wrote :

Comment fix pushed

867. By Albert Astals Cid

merge

Revision history for this message
Gerry Boland (gerboland) wrote :

Great, thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/launcher/launcher_sizing.rb'
2--- tests/launcher/launcher_sizing.rb 1970-01-01 00:00:00 +0000
3+++ tests/launcher/launcher_sizing.rb 2012-01-25 08:23:26 +0000
4@@ -0,0 +1,104 @@
5+#!/usr/bin/env ruby1.8
6+=begin
7+/*
8+ * This file is part of unity-2d
9+ *
10+ * Copyright 2012 Canonical Ltd.
11+ *
12+ * Authors:
13+ * - Albert Astals Cid <albert.astals@canonical.com>
14+ *
15+ * This program is free software; you can redistribute it and/or modify
16+ * it under the terms of the GNU General Public License as published by
17+ * the Free Software Foundation; version 3.
18+ *
19+ * This program is distributed in the hope that it will be useful,
20+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+ * GNU General Public License for more details.
23+ *
24+ * You should have received a copy of the GNU General Public License
25+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
26+ */
27+=end
28+
29+require '../run-tests.rb' unless $INIT_COMPLETED
30+require 'xdo/xwindow'
31+require 'xdo/keyboard'
32+require 'xdo/mouse'
33+require 'tmpwindow'
34+
35+############################# Test Suite #############################
36+context "Sizing tests" do
37+ PANEL_HEIGHT=24
38+ # Run once at the beginning of this test suite
39+ startup do
40+ $SUT.execute_shell_command 'killall unity-2d-launcher'
41+ $SUT.execute_shell_command 'killall unity-2d-launcher'
42+
43+ $SUT.execute_shell_command 'killall unity-2d-panel'
44+ $SUT.execute_shell_command 'killall unity-2d-panel'
45+
46+ # Minimize all windows
47+ XDo::XWindow.toggle_minimize_all
48+ end
49+
50+ # Run once at the end of this test suite
51+ shutdown do
52+ end
53+
54+ # Run before each test case begins
55+ setup do
56+ # Execute the application
57+ @app = $SUT.run( :name => UNITY_2D_LAUNCHER,
58+ :arguments => "-testability",
59+ :sleeptime => 2 )
60+
61+ # Make sure the panel is running
62+ @app_panel = $SUT.run( :name => UNITY_2D_PANEL,
63+ :arguments => "-testability",
64+ :sleeptime => 2 )
65+
66+ # Make certain application is ready for testing
67+ verify{ @app.Unity2dPanel() }
68+ end
69+
70+ # Run after each test case completes
71+ teardown do
72+ TmpWindow.close_all_windows
73+ #Need to kill Launcher and Panel as it does not shutdown when politely asked
74+ $SUT.execute_shell_command 'pkill -nf unity-2d-launcher'
75+ $SUT.execute_shell_command 'pkill -nf unity-2d-panel'
76+ end
77+
78+ #####################################################################################
79+ # Test cases
80+
81+ # Test case objectives:
82+ # * Check the Launcher updates size and position on free desktop space change
83+ # Pre-conditions
84+ # * Desktop with no running applications
85+ # Test steps
86+ # * Verify Launcher y position is the panel height
87+ # * Kill panel
88+ # * Verify Launcher y position is zero
89+ # * Verify Launcher height is old height + panel height
90+ # Post-conditions
91+ # * None
92+ # References
93+ # * None
94+ test "Launcher updates size and position on free desktop space change" do
95+ # check width before proceeding
96+ verify_equal( PANEL_HEIGHT, TIMEOUT, "Launcher is not just under the panel" ) {
97+ @app.Unity2dPanel()['y_absolute'].to_i
98+ }
99+ old_height = @app.Unity2dPanel()['height'].to_i
100+ $SUT.execute_shell_command 'pkill -nf unity-2d-panel'
101+ verify_equal( 0, TIMEOUT, "Launcher did not move to the top of the screen when killing the panel" ) {
102+ @app.Unity2dPanel()['y_absolute'].to_i
103+ }
104+ verify_equal( old_height + PANEL_HEIGHT, TIMEOUT, "Launcher did not grow vertically when killing the panel" ) {
105+ @app.Unity2dPanel()['height'].to_i
106+ }
107+ end
108+end

Subscribers

People subscribed via source and target branches