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

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 870
Merged at revision: 873
Proposed branch: lp:~aacid/unity-2d/unity-2d_test_spread_opens_launcher
Merge into: lp:unity-2d
Diff against target: 109 lines (+105/-0)
1 file modified
tests/spread/spread-tests.rb (+105/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d_test_spread_opens_launcher
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+90271@code.launchpad.net

Description of the change

[test] Check that invoking the spread opens both the spread and the launcher

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

Works good, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/spread/spread-tests.rb'
2--- tests/spread/spread-tests.rb 1970-01-01 00:00:00 +0000
3+++ tests/spread/spread-tests.rb 2012-01-26 15:10:31 +0000
4@@ -0,0 +1,105 @@
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 "Spread Tests" do
37+ # Run once at the beginning of this test suite
38+ startup do
39+ $SUT.execute_shell_command 'killall unity-2d-spread'
40+ $SUT.execute_shell_command 'killall unity-2d-spread'
41+
42+ $SUT.execute_shell_command 'killall unity-2d-launcher'
43+ $SUT.execute_shell_command 'killall unity-2d-launcher'
44+
45+ # Minimize all windows
46+ XDo::XWindow.toggle_minimize_all
47+ end
48+
49+ # Run once at the end of this test suite
50+ shutdown do
51+ end
52+
53+ # Run before each test case begins
54+ setup do
55+ # Execute the application
56+ @app_launcher = $SUT.run( :name => UNITY_2D_LAUNCHER,
57+ :arguments => "-testability",
58+ :sleeptime => 2 )
59+
60+ @app_spread = $SUT.run( :name => UNITY_2D_SPREAD,
61+ :arguments => "-testability",
62+ :sleeptime => 2 )
63+
64+ end
65+
66+ # Run after each test case completes
67+ teardown do
68+ TmpWindow.close_all_windows
69+ #Need to kill Launcher as it does not shutdown when politely asked
70+ $SUT.execute_shell_command 'pkill -nf unity-2d-launcher'
71+ $SUT.execute_shell_command 'pkill -nf unity-2d-spread'
72+ end
73+
74+ #####################################################################################
75+ # Test casess
76+
77+ # Test case objectives:
78+ # * Check that Super+s shows the launcher and the spread
79+ # Pre-conditions
80+ # * Desktop with no running applications
81+ # Test steps
82+ # * Verify spread is not showing
83+ # * Open application that overlaps with the launcher
84+ # * Verify launcher is not showing
85+ # * Press Super+s
86+ # * Verify spread is showing
87+ # * Verify launcher is showing
88+ # Post-conditions
89+ # * None
90+ # References
91+ # * None
92+ test "Super+s shows the launcher and the spread" do
93+ verify_not(2, 'There should not be a Spread declarative view on startup') {
94+ @app_spread.SpreadView()
95+ }
96+ xid = TmpWindow.open_window_at(10,100)
97+ verify_equal(-LAUNCHER_WIDTH, TIMEOUT, 'The launcher should not be visible with an overlapping window') {
98+ @app_launcher.Unity2dPanel()['x_absolute'].to_i
99+ }
100+ XDo::Keyboard.super_s
101+ verify_equal("true", TIMEOUT, 'There should be a visible Spread declarative view after pressing Alt+F2') {
102+ @app_spread.SpreadView()['visible']
103+ }
104+ verify_equal(0, TIMEOUT, 'The launcher should be visible when spread is invoked') {
105+ @app_launcher.Unity2dPanel()['x_absolute'].to_i
106+ }
107+ xid.close!
108+ end
109+end

Subscribers

People subscribed via source and target branches