summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-02-05 03:14:46 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-02-05 03:14:46 +0100
commit1774e6f71c05f5576ef7e1baf62145c4a9fdcacd (patch)
tree11abb1e93a5e3524db028c657af08ca29d3e7e9b
parent58fae9959fe2ba3b70a998fe23eeba613519923e (diff)
TestApplicationLauncherIcon: Test the ActiveQuirk value based on WindowManager
(bzr r3092.2.15)
-rw-r--r--tests/test_application_launcher_icon.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_application_launcher_icon.cpp b/tests/test_application_launcher_icon.cpp
index f409473d9..5c5122b2d 100644
--- a/tests/test_application_launcher_icon.cpp
+++ b/tests/test_application_launcher_icon.cpp
@@ -28,7 +28,7 @@
#include "ApplicationLauncherIcon.h"
#include "FavoriteStore.h"
#include "mock-application.h"
-
+#include "StandaloneWindowManager.h"
using namespace unity;
using namespace testmocks;
@@ -45,6 +45,7 @@ class TestApplicationLauncherIcon : public testing::Test
public:
virtual void SetUp()
{
+ WM = dynamic_cast<StandaloneWindowManager*>(&WindowManager::Default());
usc_app.reset(new MockApplication(USC_DESKTOP, "softwarecenter"));
usc_icon = new launcher::ApplicationLauncherIcon(usc_app);
ASSERT_EQ(usc_icon->DesktopFile(), USC_DESKTOP);
@@ -58,6 +59,7 @@ public:
ASSERT_TRUE(mock_icon->DesktopFile().empty());
}
+ StandaloneWindowManager* WM;
std::shared_ptr<MockApplication> usc_app;
std::shared_ptr<MockApplication> empty_app;
std::shared_ptr<MockApplication> mock_app;
@@ -165,4 +167,17 @@ TEST_F(TestApplicationLauncherIcon, InvalidIconUpdatesOnRunning)
EXPECT_EQ(mock_icon->icon_name(), "icon-name");
}
+TEST_F(TestApplicationLauncherIcon, ActiveQuirkWMCrossCheck)
+{
+ auto win = std::make_shared<MockApplicationWindow>(g_random_int());
+ mock_app->window_list_ = { win };
+ ASSERT_FALSE(mock_icon->IsActive());
+
+ mock_app->SetActiveState(true);
+ ASSERT_FALSE(mock_icon->IsActive());
+
+ WM->AddStandaloneWindow(std::make_shared<StandaloneWindow>(win->window_id()));
+ EXPECT_TRUE(mock_icon->IsActive());
+}
+
}