summaryrefslogtreecommitdiff
path: root/tests
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-07-24 03:05:59 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-07-24 03:05:59 +0200
commit04d5fc29ca5990da9cc2ea68919baeae89c3bf07 (patch)
tree21aba185b5bb4a36bcc9a81d275aa756a57e24e9 /tests
parenta44bf83a0b816c7b639e3e92c8e42a936eb10a2b (diff)
test_launcher_controller: added basic LauncherController test
(bzr r2509.2.1)
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt9
-rw-r--r--tests/test_launcher_controller.cpp78
2 files changed, 87 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 4a05477cf..1cc5a562d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -217,6 +217,7 @@ if (GTEST_SRC_DIR AND
test_hud_view.cpp
test_icon_loader.cpp
test_im_text_entry.cpp
+ test_launcher_controller.cpp
test_keyboard_util.cpp
test_resultviewgrid.cpp
test_single_monitor_launcher_icon.cpp
@@ -239,9 +240,11 @@ if (GTEST_SRC_DIR AND
${CMAKE_SOURCE_DIR}/hud/HudView.cpp
${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/BamfLauncherIcon.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/BFBLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/CairoBaseWindow.cpp
${CMAKE_SOURCE_DIR}/launcher/DNDCollectionWindow.cpp
${CMAKE_SOURCE_DIR}/launcher/Decaymulator.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/DesktopLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/DeviceLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/DeviceLauncherSection.cpp
${CMAKE_SOURCE_DIR}/launcher/DevicesSettings.cpp
@@ -251,9 +254,12 @@ if (GTEST_SRC_DIR AND
${CMAKE_SOURCE_DIR}/launcher/FavoriteStoreGSettings.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp
${CMAKE_SOURCE_DIR}/launcher/GeisAdapter.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/HudLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/Launcher.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/LauncherController.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherDragWindow.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemote.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemoteModel.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherHideMachine.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherHoverMachine.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherIcon.cpp
@@ -271,11 +277,14 @@ if (GTEST_SRC_DIR AND
${CMAKE_SOURCE_DIR}/launcher/QuicklistView.cpp
${CMAKE_SOURCE_DIR}/launcher/SimpleLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/SingleMonitorLauncherIcon.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/SoftwareCenterLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/SpacerLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/SwitcherController.cpp
${CMAKE_SOURCE_DIR}/launcher/SwitcherModel.cpp
${CMAKE_SOURCE_DIR}/launcher/SwitcherView.cpp
${CMAKE_SOURCE_DIR}/launcher/Tooltip.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/TrashLauncherIcon.cpp
+ ${CMAKE_SOURCE_DIR}/launcher/VolumeMonitorWrapper.cpp
${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp
${CMAKE_SOURCE_DIR}/unity-shared/BackgroundEffectHelper.cpp
${CMAKE_SOURCE_DIR}/unity-shared/DashStyle.cpp
diff --git a/tests/test_launcher_controller.cpp b/tests/test_launcher_controller.cpp
new file mode 100644
index 000000000..f3aa2fbce
--- /dev/null
+++ b/tests/test_launcher_controller.cpp
@@ -0,0 +1,78 @@
+/*
+ * 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: Marco Trevisan (Treviño) <marco.trevisan@canonical.com>
+ *
+ */
+
+#include <gmock/gmock.h>
+#include "test_utils.h"
+
+#include "PanelStyle.h"
+#include "UnitySettings.h"
+#include "FavoriteStore.h"
+#include "LauncherController.h"
+
+using namespace unity;
+using namespace unity::launcher;
+using namespace testing;
+
+namespace
+{
+
+class MockFavoriteStore : public FavoriteStore
+{
+public:
+ FavoriteList const& GetFavorites()
+ {
+ return fav_list_;
+ };
+
+ void AddFavorite(std::string const& desktop_path, int position) {};
+ void RemoveFavorite(std::string const& desktop_path) {};
+ void MoveFavorite(std::string const& desktop_path, int position) {};
+ void SetFavorites(FavoriteList const& desktop_paths) {};
+
+private:
+ FavoriteList fav_list_;
+};
+
+class TestLauncherController : public Test
+{
+public:
+ TestLauncherController()
+ : lc(nux::GetGraphicsDisplay()->GetX11Display())
+ {}
+
+ virtual void SetUp()
+ {
+ lc.options = std::make_shared<Options>();
+ lc.multiple_launchers = true;
+ }
+
+ Settings settings;
+ panel::Style panel_style;
+ MockFavoriteStore favorite_store;
+ Controller lc;
+};
+
+TEST_F(TestLauncherController, Construction)
+{
+ EXPECT_NE(lc.options(), nullptr);
+ EXPECT_TRUE(lc.multiple_launchers());
+}
+
+}