~ubuntu-branches/ubuntu/precise/unity-2d/precise-security

« back to all changes in this revision

Viewing changes to tests/panel/panel-tests.rb

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2012-03-23 15:33:38 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20120323153338-z6d9emr9vfhr22df
Tags: 5.8.0-0ubuntu1
* New upstream release
  - Loss of DBus connection with active Dash/Hud results in broken panel
    (LP: #953168)
  - [launcher] super key and number from _keypad_ doesn't work (LP: #750514)
  - [dash] Home lens state not reset if dash closed & reopened (LP: #948299)
  - HUD is silent to screen readers (LP: #949445)
  - Use title case capitalization "Lock to Launcher" & "Unlock from
    Launcher" (LP: #949636)
  - tiles highlight incorrect, highlight only visible at edge (LP: #953403)
  - [UIFe] Use average color of wallpaper to tint launcher/dash/panel/hud
    (LP: #960194)
* debian/control:
  - build-dep on latest nux and unity-core

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby1.8
 
2
=begin
 
3
/*
 
4
 * This file is part of unity-2d
 
5
 *
 
6
 * Copyright 2012 Canonical Ltd.
 
7
 *
 
8
 * Authors:
 
9
 * - Pawel Stolowski <pawel.stolowski@canonical.com>
 
10
 *
 
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.
 
14
 *
 
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.
 
19
 *
 
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/>.
 
22
 */
 
23
=end
 
24
 
 
25
require '../run-tests.rb' unless $INIT_COMPLETED
 
26
require 'xdo/keyboard'
 
27
 
 
28
############################# Test Suite #############################
 
29
context "Panel visual verification tests" do
 
30
  # Run once at the beginning of this test suite
 
31
  startup do
 
32
    $SUT.execute_shell_command 'killall unity-2d-panel'
 
33
    $SUT.execute_shell_command 'killall unity-2d-panel'
 
34
 
 
35
    $SUT.execute_shell_command 'killall unity-2d-shell'
 
36
    $SUT.execute_shell_command 'killall unity-2d-shell'
 
37
  end
 
38
 
 
39
  # Run once at the end of this test suite
 
40
  teardown do
 
41
    $SUT.execute_shell_command 'killall unity-2d-panel'
 
42
    $SUT.execute_shell_command 'killall unity-2d-shell'
 
43
  end
 
44
 
 
45
  # Run before each test case begins
 
46
  setup do
 
47
    # Execute the application 
 
48
    @panel = $SUT.run( :name => UNITY_2D_PANEL,
 
49
                     :arguments => "-testability",
 
50
                     :sleeptime => 2 )
 
51
 
 
52
    @launcher = $SUT.run( :name => UNITY_2D_SHELL,
 
53
                       :arguments => "-testability",
 
54
                       :sleeptime => 2 )
 
55
 
 
56
  end
 
57
 
 
58
  # Run after each test case completes
 
59
  teardown do
 
60
    $SUT.execute_shell_command 'pkill -nf unity-2d-panel'
 
61
    $SUT.execute_shell_command 'pkill -nf unity-2d-shell'
 
62
  end
 
63
 
 
64
  #####################################################################################
 
65
  # Test cases
 
66
  #
 
67
  
 
68
  # Test case objectives:
 
69
  #  * Check that killing shell while dash is open resets panel
 
70
  # Pre-conditions
 
71
  #  * Desktop with no running apps
 
72
  # Test steps
 
73
  #   * Press Super
 
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)
 
78
  # Post-conditions
 
79
  #   * None
 
80
  # References
 
81
  #   * https://bugs.launchpad.net/unity-2d/+bug/953168
 
82
  test "Killing shell while dash is active resets panel to sane state" do
 
83
    XDo::Keyboard.super
 
84
 
 
85
    verify_equal("true", TIMEOUT, 'There should be a Dash after pressing Super') {
 
86
      @launcher.Dash()['active']
 
87
    }
 
88
    
 
89
    $SUT.execute_shell_command 'pkill -nf unity-2d-shell'
 
90
 
 
91
    verify_equal('Ubuntu Desktop', TIMEOUT, 'Panel caption should be Ubuntu Desktop') {
 
92
        @panel.Unity2dPanel(:name=>'0').AppNameApplet().CroppedLabel()['text']
 
93
    }
 
94
 
 
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
 
97
    }
 
98
  end
 
99
 
 
100
  # Test case objectives:
 
101
  #  * Check that killing shell while hud is open resets panel
 
102
  # Pre-conditions
 
103
  #  * Desktop with no running apps
 
104
  # Test steps
 
105
  #   * Press Alt
 
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)
 
110
  # Post-conditions
 
111
  #   * None
 
112
  # References
 
113
  #   * https://bugs.launchpad.net/unity-2d/+bug/953168
 
114
  test "Killing shell while hud is active resets panel to sane state" do
 
115
    XDo::Keyboard.alt
 
116
 
 
117
    verify_equal("true", TIMEOUT, 'There should be a Hud after pressing Alt') {
 
118
      @launcher.Hud()['active']
 
119
    }
 
120
    
 
121
    $SUT.execute_shell_command 'pkill -nf unity-2d-shell'
 
122
 
 
123
    verify_equal('Ubuntu Desktop', TIMEOUT, 'Panel caption should be Ubuntu Desktop') {
 
124
        @panel.Unity2dPanel(:name=>'0').AppNameApplet().CroppedLabel()['text']
 
125
    }
 
126
 
 
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
 
129
    }
 
130
  end
 
131
end