~mial/ubuntu/oneiric/unity/bug-791810

« back to all changes in this revision

Viewing changes to tests/ui/test-home-button.vala

Import the work done so far with Compiz

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
 
2
/*
 
3
 * Copyright (C) 2010 Canonical Ltd
 
4
 *
 
5
 * This program is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License version 3 as
 
7
 * published by the Free Software Foundation.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 *
 
17
 * Authored by Mirco Müller <mirco.mueller@canonical.com>
 
18
 *
 
19
 */
 
20
 
 
21
using Unity;
 
22
using Unity.Testing;
 
23
using Unity.Panel;
 
24
 
 
25
bool g_flag = false;
 
26
 
 
27
namespace Unity.Tests.UI
 
28
{
 
29
  public class HomeButtonSuite : Object, Shell
 
30
  {
 
31
    private const string DOMAIN = "/UI/HomeButton";
 
32
 
 
33
    Unity.Testing.Window?  window;
 
34
    Clutter.Stage?         stage;
 
35
    Unity.Testing.Director director;
 
36
    Unity.Panel.HomeButton home_button;
 
37
    public bool          super_key_active {get; set;}
 
38
    public bool is_starting {get; set;}
 
39
 
 
40
    public HomeButtonSuite ()
 
41
    {
 
42
      Logging.init_fatal_handler ();
 
43
 
 
44
      /* Testup the test window */
 
45
      window = new Unity.Testing.Window (true, 1024, 600);
 
46
      window.init_test_mode ();
 
47
      stage = window.stage;
 
48
      window.title = "HomeButton Test";
 
49
      window.show_all ();
 
50
 
 
51
      home_button = new Unity.Panel.HomeButton (this);
 
52
      director = new Unity.Testing.Director (stage);
 
53
 
 
54
      Test.add_data_func (DOMAIN + "/HomeButton", test_click_home_button);
 
55
    }
 
56
 
 
57
 
 
58
    private void test_click_home_button ()
 
59
    {
 
60
      director.button_press (home_button, 1, true, 1.0f, 1.0f, false);
 
61
 
 
62
      Logging.init_fatal_handler ();
 
63
 
 
64
      assert (g_flag == true);
 
65
    }
 
66
 
 
67
    //
 
68
    // mostly a dummy shell-implementation to satisfy the interface
 
69
    //
 
70
    public bool menus_swallow_events { get { return true; } }
 
71
 
 
72
    public void get_window_details (uint32 xid, out bool a, out bool b)
 
73
    {
 
74
 
 
75
    }
 
76
 
 
77
    public void do_window_action (uint32 xid, WindowAction action)
 
78
    {
 
79
 
 
80
    }
 
81
 
 
82
    public ShellMode
 
83
    get_mode ()
 
84
    {
 
85
      return ShellMode.MINIMIZED;
 
86
    }
 
87
 
 
88
    public Clutter.Stage
 
89
    get_stage ()
 
90
    {
 
91
      return this.stage;
 
92
    }
 
93
 
 
94
    public void
 
95
    show_unity ()
 
96
    {
 
97
      g_flag = true;
 
98
    }
 
99
 
 
100
    public void
 
101
    hide_unity ()
 
102
    {
 
103
 
 
104
    }
 
105
 
 
106
    public int
 
107
    get_indicators_width ()
 
108
    {
 
109
      // stub
 
110
      return 0;
 
111
    }
 
112
 
 
113
    public int
 
114
    get_launcher_width_foobar ()
 
115
    {
 
116
      // stub
 
117
      return 0;
 
118
    }
 
119
 
 
120
    public int
 
121
    get_panel_height_foobar ()
 
122
    {
 
123
      // stub
 
124
      return 0;
 
125
    }
 
126
 
 
127
    public void
 
128
    ensure_input_region ()
 
129
    {
 
130
      // stub
 
131
    }
 
132
 
 
133
    public void
 
134
    add_fullscreen_request (Object o)
 
135
    {
 
136
      // stub
 
137
    }
 
138
 
 
139
    public bool
 
140
    remove_fullscreen_request (Object o)
 
141
    {
 
142
      // stub
 
143
      return false;
 
144
    }
 
145
 
 
146
    public void
 
147
    grab_keyboard (bool grab, uint32 timestamp)
 
148
    {
 
149
      // stub
 
150
    }
 
151
 
 
152
    public void
 
153
    about_to_show_places ()
 
154
    {
 
155
      // stub
 
156
    }
 
157
 
 
158
    public void
 
159
    close_xids (Array<uint32> xids)
 
160
    {
 
161
      // stub
 
162
    }
 
163
 
 
164
    public void
 
165
    show_window (uint32 xid)
 
166
    {
 
167
      // stub
 
168
    }
 
169
 
 
170
                public void
 
171
                expose_xids (Array<uint32> xids)
 
172
                {
 
173
      // stub
 
174
                }
 
175
 
 
176
                public void
 
177
                stop_expose ()
 
178
                {
 
179
      // stub
 
180
                }
 
181
 
 
182
    public uint32 get_current_time ()
 
183
    {
 
184
      return Clutter.get_current_event_time ();
 
185
    }
 
186
  }
 
187
}
 
188