summaryrefslogtreecommitdiff
diff options
authorAndrea Azzarone <azzaronea@gmail.com>2012-09-14 20:07:22 -0400
committerTarmac <>2012-09-14 20:07:22 -0400
commit4a9aac9949725f5258da562c696b93b4f02ba0be (patch)
treed6b0dc641de86ec80f52e479e6afb84ff103697c
parent0304fccb7b63ecb05fb45e4bd39999678e26225d (diff)
parent7c53c021950806c1ecd66513fd888759bf929dbe (diff)
Raise shortcut overlay on show.. Fixes: https://bugs.launchpad.net/bugs/985883. Approved by Brandon Schaefer.
(bzr r2696)
-rw-r--r--plugins/unityshell/src/unityshell.cpp4
-rw-r--r--shortcuts/AbstractShortcutHint.h20
-rw-r--r--shortcuts/BaseWindowRaiser.h47
-rw-r--r--shortcuts/BaseWindowRaiserImp.cpp33
-rw-r--r--shortcuts/BaseWindowRaiserImp.h39
-rw-r--r--shortcuts/CMakeLists.txt1
-rw-r--r--shortcuts/MockShortcutHint.h16
-rw-r--r--shortcuts/ShortcutController.cpp30
-rw-r--r--shortcuts/ShortcutController.h33
-rw-r--r--shortcuts/ShortcutModel.cpp17
-rw-r--r--shortcuts/ShortcutModel.h21
-rw-r--r--shortcuts/StandaloneShortcuts.cpp4
-rw-r--r--tests/CMakeLists.txt7
-rw-r--r--tests/test_shortcut_controller.cpp62
14 files changed, 254 insertions, 80 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 74ffa6ddd..f00fd11bd 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -25,6 +25,7 @@
#include <Nux/BaseWindow.h>
#include <Nux/WindowCompositor.h>
+#include "BaseWindowRaiserImp.h"
#include "IconRenderer.h"
#include "Launcher.h"
#include "LauncherIcon.h"
@@ -2974,7 +2975,8 @@ void UnityScreen::initLauncher()
// Setup Shortcut Hint
InitHints();
- shortcut_controller_ = std::make_shared<shortcut::Controller>(hints_);
+ auto base_window_raiser_ = std::make_shared<shortcut::BaseWindowRaiserImp>();
+ shortcut_controller_ = std::make_shared<shortcut::Controller>(hints_, base_window_raiser_);
AddChild(shortcut_controller_.get());
AddChild(dash_controller_.get());
diff --git a/shortcuts/AbstractShortcutHint.h b/shortcuts/AbstractShortcutHint.h
index abd20a944..1531e8061 100644
--- a/shortcuts/AbstractShortcutHint.h
+++ b/shortcuts/AbstractShortcutHint.h
@@ -14,12 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * Authored by: Andrea Azzarone <azzaronea@gmail.com>
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
*/
#ifndef UNITYSHELL_ABSTRACT_SHORTCUT_ICON_H
#define UNITYSHELL_ABSTRACT_SHORTCUT_ICON_H
+#include <memory>
#include <string>
#include <Nux/Nux.h>
@@ -44,7 +45,7 @@ class AbstractHint
{
public:
typedef std::shared_ptr<AbstractHint> Ptr;
- // Ctor
+
AbstractHint(std::string const& category,
std::string const& prefix,
std::string const& postfix,
@@ -61,10 +62,8 @@ public:
, arg1(arg1)
, arg2(arg2)
, arg3(arg3)
- {
- }
+ {}
- // Copy ctor
AbstractHint(unity::shortcut::AbstractHint const& obj)
: category(obj.category())
, prefix(obj.prefix())
@@ -76,13 +75,10 @@ public:
, arg3(obj.arg3())
, value(obj.value())
, shortkey(obj.shortkey())
- {
- }
+ {}
- // Dtor
virtual ~AbstractHint(){};
- // Public Methods
virtual bool Fill() = 0;
// Properties
@@ -98,7 +94,7 @@ public:
nux::Property<std::string> shortkey;
};
-} // namespace shortcut
-} // namespace unity
+}
+}
-#endif // UNITYSHELL_ABSTRACT_SHORTCUT_ICON_H
+#endif
diff --git a/shortcuts/BaseWindowRaiser.h b/shortcuts/BaseWindowRaiser.h
new file mode 100644
index 000000000..d80ec9c39
--- /dev/null
+++ b/shortcuts/BaseWindowRaiser.h
@@ -0,0 +1,47 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ */
+
+#ifndef UNITYSHELL_BASE_WINDOW_RAISER_H
+#define UNITYSHELL_BASE_WINDOW_RAISER_H
+
+#include <boost/noncopyable.hpp>
+#include <memory>
+
+#include <Nux/Nux.h>
+#include <Nux/BaseWindow.h>
+
+namespace unity
+{
+namespace shortcut
+{
+
+class BaseWindowRaiser : boost::noncopyable
+{
+public:
+ typedef std::shared_ptr<BaseWindowRaiser> Ptr;
+
+ virtual ~BaseWindowRaiser() {};
+
+ virtual void Raise(nux::ObjectPtr<nux::BaseWindow> window) = 0;
+};
+
+}
+}
+
+#endif
diff --git a/shortcuts/BaseWindowRaiserImp.cpp b/shortcuts/BaseWindowRaiserImp.cpp
new file mode 100644
index 000000000..bfcee70b6
--- /dev/null
+++ b/shortcuts/BaseWindowRaiserImp.cpp
@@ -0,0 +1,33 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ */
+
+#include "BaseWindowRaiserImp.h"
+
+namespace unity
+{
+namespace shortcut
+{
+
+void BaseWindowRaiserImp::Raise(nux::ObjectPtr<nux::BaseWindow> window)
+{
+ window->PushToFront();
+}
+
+}
+}
diff --git a/shortcuts/BaseWindowRaiserImp.h b/shortcuts/BaseWindowRaiserImp.h
new file mode 100644
index 000000000..86ffd05df
--- /dev/null
+++ b/shortcuts/BaseWindowRaiserImp.h
@@ -0,0 +1,39 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ */
+
+#ifndef UNITYSHELL_BASE_WINDOW_RAISER_IMP_H
+#define UNITYSHELL_BASE_WINDOW_RAISER_IMP_H
+
+#include "BaseWindowRaiser.h"
+
+namespace unity
+{
+namespace shortcut
+{
+
+class BaseWindowRaiserImp : public BaseWindowRaiser
+{
+public:
+ virtual void Raise(nux::ObjectPtr<nux::BaseWindow> window);
+};
+
+}
+}
+
+#endif
diff --git a/shortcuts/CMakeLists.txt b/shortcuts/CMakeLists.txt
index 1b280a4a0..80f520c90 100644
--- a/shortcuts/CMakeLists.txt
+++ b/shortcuts/CMakeLists.txt
@@ -30,6 +30,7 @@ include_directories (. .. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_D
#
set (SHORTCUTS_SOURCES
AbstractShortcutHint.h
+ BaseWindowRaiserImp.cpp
MockShortcutHint.h
ShortcutController.cpp
ShortcutController.h
diff --git a/shortcuts/MockShortcutHint.h b/shortcuts/MockShortcutHint.h
index b0c3fbd22..74ac97aa3 100644
--- a/shortcuts/MockShortcutHint.h
+++ b/shortcuts/MockShortcutHint.h
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * Authored by: Andrea Azzarone <azzaronea@gmail.com>
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
*/
#ifndef UNITYSHELL_MOCK_SHORTCUT_HINT_H
@@ -30,7 +30,8 @@ namespace shortcut
class MockHint : public AbstractHint
{
public:
- // Ctor and dtor
+ typedef std::shared_ptr<MockHint> Ptr;
+
MockHint(std::string const& category,
std::string const& prefix,
std::string const& postfix,
@@ -40,10 +41,7 @@ public:
std::string const& arg2 = "",
std::string const& arg3 = "")
: AbstractHint(category, prefix, postfix, description, type, arg1, arg2, arg3)
- {
- }
-
- ~MockHint() {};
+ {}
// Methods...
bool Fill()
@@ -67,7 +65,7 @@ public:
}
};
-} // shortcut hint
-} // namespace unity
+}
+}
-#endif // UNITYSHELL_MOCK_SHORTCUT_HINT_H
+#endif
diff --git a/shortcuts/ShortcutController.cpp b/shortcuts/ShortcutController.cpp
index 2a97ae7e6..995021bbf 100644
--- a/shortcuts/ShortcutController.cpp
+++ b/shortcuts/ShortcutController.cpp
@@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * Authored by: Andrea Azzarone <azzaronea@gmail.com>
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
*/
#include "ShortcutController.h"
@@ -29,37 +29,37 @@ namespace
{
const unsigned int SUPER_TAP_DURATION = 650;
const unsigned int FADE_DURATION = 100;
-} // anonymouse namespace;
+}
-Controller::Controller(std::list<AbstractHint::Ptr>& hints)
- : visible_(false)
+Controller::Controller(std::list<AbstractHint::Ptr> const& hints,
+ BaseWindowRaiser::Ptr const& base_window_raiser)
+ : model_(std::make_shared<Model>(hints))
+ , base_window_raiser_(base_window_raiser)
+ , visible_(false)
, enabled_(true)
+ , bg_color_(0.0, 0.0, 0.0, 0.5)
, fade_in_animator_(FADE_DURATION)
, fade_out_animator_(FADE_DURATION)
{
- bg_color_ = nux::Color(0.0, 0.0, 0.0, 0.5);
+ model_->Fill();
ubus_manager_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED,
sigc::mem_fun(this, &Controller::OnBackgroundUpdate));
- ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWITCHER, [&] (GVariant*) {
+ ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWITCHER, [this] (GVariant*) {
enabled_ = false;
});
- ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_SWITCHER, [&] (GVariant*) {
+ ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_SWITCHER, [this] (GVariant*) {
enabled_ = true;
});
- ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, [&] (GVariant*) {
+ ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, [this] (GVariant*) {
Hide();
});
ubus_manager_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT);
- model_.reset(new Model(hints));
-
- model_->Fill();
-
fade_in_animator_.animation_updated.connect(sigc::mem_fun(this, &Controller::OnFadeInUpdated));
fade_in_animator_.animation_ended.connect(sigc::mem_fun(this, &Controller::OnFadeInEnded));
fade_out_animator_.animation_updated.connect(sigc::mem_fun(this, &Controller::OnFadeOutUpdated));
@@ -87,7 +87,6 @@ void Controller::OnFadeOutEnded()
view_window_->SetOpacity(0.0);
}
-
void Controller::OnBackgroundUpdate(GVariant* data)
{
gdouble red, green, blue, alpha;
@@ -118,6 +117,7 @@ bool Controller::OnShowTimer()
return false;
EnsureView();
+ base_window_raiser_->Raise(view_window_);
nux::Geometry geo;
if (!view_->GetBaseGeometry(geo))
@@ -190,12 +190,12 @@ void Controller::Hide()
}
}
-bool Controller::Visible()
+bool Controller::Visible() const
{
return visible_;
}
-bool Controller::IsEnabled()
+bool Controller::IsEnabled() const
{
return enabled_;
}
diff --git a/shortcuts/ShortcutController.h b/shortcuts/ShortcutController.h
index b1d6ac14f..e4af3c954 100644
--- a/shortcuts/ShortcutController.h
+++ b/shortcuts/ShortcutController.h
@@ -13,13 +13,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * Authored by: Andrea Azzarone <azzaronea@gmail.com>
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
*/
-#ifndef UNITYSHELL_SHORTCUTCONTROLLER_H
-#define UNITYSHELL_SHORTCUTCONTROLLER_H
+#ifndef UNITYSHELL_SHORTCUT_CONTROLLER_H
+#define UNITYSHELL_SHORTCUT_CONTROLLER_H
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Nux/Nux.h>
#include <Nux/BaseWindow.h>
@@ -28,10 +28,11 @@
#include <UnityCore/Variant.h>
#include <UnityCore/GLibSource.h>
-#include "unity-shared/Animator.h"
-#include "unity-shared/Introspectable.h"
+#include "BaseWindowRaiser.h"
#include "ShortcutModel.h"
#include "ShortcutView.h"
+#include "unity-shared/Animator.h"
+#include "unity-shared/Introspectable.h"
#include "unity-shared/UBusWrapper.h"
namespace unity
@@ -44,25 +45,24 @@ class Controller : public debug::Introspectable
public:
typedef std::shared_ptr<Controller> Ptr;
- // Ctor
- Controller(std::list<AbstractHint::Ptr>& hints);
+ Controller(std::list<AbstractHint::Ptr> const& hints,
+ BaseWindowRaiser::Ptr const& raiser);
- // Public Methods
bool Show();
void Hide();
- bool Visible();
- bool IsEnabled();
+ bool Visible() const;
+ bool IsEnabled() const;
void SetAdjustment(int x, int y);
void SetEnabled(bool enabled);
protected:
+ // Introspectable
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);
private:
- // Private Methods
void ConstructView();
void EnsureView();
void OnBackgroundUpdate(GVariant* data);
@@ -72,9 +72,9 @@ private:
void OnFadeOutEnded();
bool OnShowTimer();
- // Private Members
View::Ptr view_;
Model::Ptr model_;
+ BaseWindowRaiser::Ptr base_window_raiser_;
nux::Geometry workarea_;
nux::ObjectPtr<nux::BaseWindow> view_window_;
@@ -91,8 +91,7 @@ private:
UBusManager ubus_manager_;
};
-} // namespace shortcut
-} // namespace unity
-
-#endif //UNITYSHELL_SHORTCUTHINTCONTROLLER_H
+}
+}
+#endif
diff --git a/shortcuts/ShortcutModel.cpp b/shortcuts/ShortcutModel.cpp
index c318bd898..2337d6479 100644
--- a/shortcuts/ShortcutModel.cpp
+++ b/shortcuts/ShortcutModel.cpp
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * Authored by: Andrea Azzarone <azzaronea@gmail.com>
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
*/
#include "ShortcutModel.h"
@@ -24,20 +24,13 @@ namespace unity
namespace shortcut
{
-// Ctor
-Model::Model(std::list<AbstractHint::Ptr>& hints)
+Model::Model(std::list<AbstractHint::Ptr> const& hints)
{
for (auto hint : hints)
AddHint(hint);
}
-// Dtor
-Model::~Model()
-{
-}
-
-
-void Model::AddHint(AbstractHint::Ptr hint)
+void Model::AddHint(AbstractHint::Ptr const& hint)
{
if (!hint)
return;
@@ -56,5 +49,5 @@ void Model::Fill()
item->Fill();
}
-} // namespace shortcut
-} // namespace unity
+}
+}
diff --git a/shortcuts/ShortcutModel.h b/shortcuts/ShortcutModel.h
index 7344d372b..5543537a1 100644
--- a/shortcuts/ShortcutModel.h
+++ b/shortcuts/ShortcutModel.h
@@ -14,11 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * Authored by: Andrea Azzarone <azzaronea@gmail.com>
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
*/
-#ifndef UNITYSHELL_SHORTCUSMODEL_H
-#define UNITYSHELL_SHORTCUSMODEL_H
+#ifndef UNITYSHELL_SHORTCUS_MODEL_H
+#define UNITYSHELL_SHORTCUS_MODEL_H
#include <boost/noncopyable.hpp>
#include <map>
@@ -39,26 +39,21 @@ class Model : boost::noncopyable
public:
typedef std::shared_ptr<Model> Ptr;
- // Ctor and dtor
- Model(std::list<AbstractHint::Ptr>& hints);
- ~Model();
+ Model(std::list<AbstractHint::Ptr> const& hints);
- // Accessors
std::vector<std::string>& categories() { return categories_; }
std::map<std::string, std::list<AbstractHint::Ptr>>& hints() { return hints_; }
void Fill();
private:
- // Private functions
- void AddHint(AbstractHint::Ptr hint);
+ void AddHint(AbstractHint::Ptr const& hint);
- // Private members
std::vector<std::string> categories_;
std::map<std::string, std::list<AbstractHint::Ptr>> hints_;
};
-} // shortcut
-} // unity
+}
+}
-#endif // UNITYSHELL_SHORTCUTS_H
+#endif
diff --git a/shortcuts/StandaloneShortcuts.cpp b/shortcuts/StandaloneShortcuts.cpp
index 6285967ba..de48a5317 100644
--- a/shortcuts/StandaloneShortcuts.cpp
+++ b/shortcuts/StandaloneShortcuts.cpp
@@ -23,6 +23,7 @@
#include <Nux/WindowThread.h>
#include "unity-shared/BackgroundEffectHelper.h"
+#include "BaseWindowRaiserImp.h"
#include "MockShortcutHint.h"
#include "ShortcutController.h"
@@ -228,7 +229,8 @@ void ThreadWidgetInit(nux::NThread* thread, void* InitData)
"resize",
"initiate_key")));
- controller.reset(new shortcut::Controller(hints));
+ auto base_window_raiser_ = std::make_shared<shortcut::BaseWindowRaiserImp>();
+ controller.reset(new shortcut::Controller(hints, base_window_raiser_));
controller->Show();
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e8542d1fc..d11488371 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -223,6 +223,7 @@ if (GTEST_SRC_DIR AND
test_quicklist_menu_item.cpp
test_quicklist_view.cpp
test_resultviewgrid.cpp
+ test_shortcut_controller.cpp
test_single_monitor_launcher_icon.cpp
test_switcher_controller.cpp
test_switcher_model.cpp
@@ -305,6 +306,11 @@ if (GTEST_SRC_DIR AND
${CMAKE_SOURCE_DIR}/launcher/VolumeImp.cpp
${CMAKE_SOURCE_DIR}/launcher/VolumeLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/VolumeMonitorWrapper.cpp
+ ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutController.cpp
+ ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutModel.cpp
+ #${CMAKE_SOURCE_DIR}/shortcuts/ShortcutHintPrivate.cpp
+ ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutView.cpp
+ ${CMAKE_SOURCE_DIR}/unity-shared/AbstractSeparator.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp
${CMAKE_SOURCE_DIR}/unity-shared/BackgroundEffectHelper.cpp
${CMAKE_SOURCE_DIR}/unity-shared/CoverArt.cpp
@@ -317,6 +323,7 @@ if (GTEST_SRC_DIR AND
${CMAKE_SOURCE_DIR}/unity-shared/IMTextEntry.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
${CMAKE_SOURCE_DIR}/unity-shared/IntrospectableWrappers.cpp
+ ${CMAKE_SOURCE_DIR}/unity-shared/LineSeparator.cpp
${CMAKE_SOURCE_DIR}/unity-shared/JSONParser.cpp
${CMAKE_SOURCE_DIR}/unity-shared/KeyboardUtil.cpp
${CMAKE_SOURCE_DIR}/unity-shared/OverlayRenderer.cpp
diff --git a/tests/test_shortcut_controller.cpp b/tests/test_shortcut_controller.cpp
new file mode 100644
index 000000000..cec1ad745
--- /dev/null
+++ b/tests/test_shortcut_controller.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2012 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 3 along with this program. If not, see
+ * <http://www.gnu.org/licenses/>
+ *
+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
+ */
+
+#include <gmock/gmock.h>
+using namespace testing;
+
+#include "shortcuts/BaseWindowRaiser.h"
+#include "shortcuts/ShortcutController.h"
+using namespace unity;
+
+#include "test_utils.h"
+
+namespace
+{
+
+class MockBaseWindowRaiser : public shortcut::BaseWindowRaiser
+{
+public:
+ typedef std::shared_ptr<MockBaseWindowRaiser> Ptr;
+
+ MOCK_METHOD1 (Raise, void(nux::ObjectPtr<nux::BaseWindow> window));
+};
+
+class TestShortcutController : public Test
+{
+public:
+ TestShortcutController()
+ : base_window_raiser_(std::make_shared<MockBaseWindowRaiser>())
+ , controller_(hints_, base_window_raiser_)
+ {}
+
+ std::list<shortcut::AbstractHint::Ptr> hints_;
+ MockBaseWindowRaiser::Ptr base_window_raiser_;
+ shortcut::Controller controller_;
+};
+
+TEST_F (TestShortcutController, WindowIsRaisedOnShow)
+{
+ EXPECT_CALL(*base_window_raiser_, Raise(_))
+ .Times(1);
+
+ controller_.Show();
+ Utils::WaitForTimeout(1);
+}
+
+}