4
* This file is part of unity-2d
6
* Copyright 2012 Canonical Ltd.
9
* - Pawel Stolowski <pawel.stolowski@canonical.com>
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; version 3.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
require '../run-tests.rb' unless $INIT_COMPLETED
26
require 'xdo/keyboard'
28
############################# Test Suite #############################
29
context "Panel visual verification tests" do
30
# Run once at the beginning of this test suite
32
$SUT.execute_shell_command 'killall unity-2d-panel'
33
$SUT.execute_shell_command 'killall unity-2d-panel'
35
$SUT.execute_shell_command 'killall unity-2d-shell'
36
$SUT.execute_shell_command 'killall unity-2d-shell'
39
# Run once at the end of this test suite
41
$SUT.execute_shell_command 'killall unity-2d-panel'
42
$SUT.execute_shell_command 'killall unity-2d-shell'
45
# Run before each test case begins
47
# Execute the application
48
@panel = $SUT.run( :name => UNITY_2D_PANEL,
49
:arguments => "-testability",
52
@launcher = $SUT.run( :name => UNITY_2D_SHELL,
53
:arguments => "-testability",
58
# Run after each test case completes
60
$SUT.execute_shell_command 'pkill -nf unity-2d-panel'
61
$SUT.execute_shell_command 'pkill -nf unity-2d-shell'
64
#####################################################################################
68
# Test case objectives:
69
# * Check that killing shell while dash is open resets panel
71
# * Desktop with no running apps
74
# * Verify dash is showing
75
# * kill shell process
76
# * Verify panel caption says 'Ubuntu Desktop'
77
# * Verify caption absolute x position is 0 (=no window buttons are displayed)
81
# * https://bugs.launchpad.net/unity-2d/+bug/953168
82
test "Killing shell while dash is active resets panel to sane state" do
85
verify_equal("true", TIMEOUT, 'There should be a Dash after pressing Super') {
86
@launcher.Dash()['active']
89
$SUT.execute_shell_command 'pkill -nf unity-2d-shell'
91
verify_equal('Ubuntu Desktop', TIMEOUT, 'Panel caption should be Ubuntu Desktop') {
92
@panel.Unity2dPanel(:name=>'0').AppNameApplet().CroppedLabel()['text']
95
verify_equal(0, TIMEOUT, 'Panel label should start at left edge of screen, meaning no window buttons are displayed') {
96
@panel.Unity2dPanel(:name=>'0').AppNameApplet().CroppedLabel()['x_absolute'].to_i
100
# Test case objectives:
101
# * Check that killing shell while hud is open resets panel
103
# * Desktop with no running apps
106
# * Verify hud is showing
107
# * kill shell process
108
# * Verify panel caption says 'Ubuntu Desktop'
109
# * Verify caption absolute x position is 0 (=no window buttons are displayed)
113
# * https://bugs.launchpad.net/unity-2d/+bug/953168
114
test "Killing shell while hud is active resets panel to sane state" do
117
verify_equal("true", TIMEOUT, 'There should be a Hud after pressing Alt') {
118
@launcher.Hud()['active']
121
$SUT.execute_shell_command 'pkill -nf unity-2d-shell'
123
verify_equal('Ubuntu Desktop', TIMEOUT, 'Panel caption should be Ubuntu Desktop') {
124
@panel.Unity2dPanel(:name=>'0').AppNameApplet().CroppedLabel()['text']
127
verify_equal(0, TIMEOUT, 'Panel label should start at left edge of screen, meaning no window buttons are displayed') {
128
@panel.Unity2dPanel(:name=>'0').AppNameApplet().CroppedLabel()['x_absolute'].to_i