2
* Copyright 2012-2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* version 3 along with this program. If not, see
15
* <http://www.gnu.org/licenses/>
17
* Authored by: Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
21
#ifndef TEST_SWITCHER_CONTROLLER_H
22
#define TEST_SWITCHER_CONTROLLER_H
24
#include <NuxCore/AnimationController.h>
25
#include <gmock/gmock.h>
28
#include "test_utils.h"
29
#include "DesktopLauncherIcon.h"
30
#include "SimpleLauncherIcon.h"
31
#include "SwitcherController.h"
32
#include "SwitcherView.h"
34
#include "unity-shared/UnitySettings.h"
35
#include "mock-base-window.h"
37
using namespace std::chrono;
39
typedef std::chrono::high_resolution_clock Clock;
41
#ifdef ENABLE_DELAYED_TWO_PHASE_CONSTRUCTION_TESTS
42
unsigned int DEFAULT_LAZY_CONSTRUCT_TIMEOUT = 20;
45
const unsigned FADE_DURATION = 80 * 1000; // in microseconds
46
const unsigned TICK_DURATION = 10 * 1000;
49
* A fake ApplicationWindow for verifying selection of the switcher.
51
class FakeApplicationWindow : public unity::ApplicationWindow
54
FakeApplicationWindow(Window xid);
56
std::string title() const;
57
virtual std::string icon() const;
58
virtual std::string type() const;
60
virtual Window window_id() const;
61
virtual int monitor() const;
62
virtual unity::ApplicationPtr application() const;
63
virtual bool Focus() const;
64
virtual void Quit() const;
70
* A fake LauncherIcon for verifying selection operations of the switcher.
72
class FakeLauncherIcon : public unity::launcher::SimpleLauncherIcon
75
FakeLauncherIcon(std::string const& app_name, unsigned priority);
77
unity::WindowList Windows();
78
unsigned long long SwitcherPriority();
82
unity::WindowList window_list;
87
* The base test fixture for verifying the Switcher interface.
89
class TestSwitcherController : public testing::Test
92
TestSwitcherController();
94
// required to create hidden secret global variables before test objects
95
unity::Settings unity_settings_;
97
nux::animation::TickSource tick_source_;
98
nux::animation::AnimationController animation_controller_;
99
unity::testmocks::MockBaseWindow::Ptr mock_window_;
100
unity::switcher::Controller::Ptr controller_;
101
std::vector<unity::launcher::AbstractLauncherIcon::Ptr> icons_;
104
#endif // TEST_SWITCHER_CONTROLLER_H