diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-11-13 21:54:13 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-11-13 21:54:13 +0100 |
| commit | d67fc00e4aca3144956e1a9a21ef920a9393f084 (patch) | |
| tree | d422674fe47fb46b7026cacaaf985d6926c4a8c9 /tests | |
| parent | 51a7bae949ddd380bba052e60d7ca19745a3c4ae (diff) | |
TestLauncherController: fix some random failures
(bzr r2892.2.1)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_launcher_controller.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/tests/test_launcher_controller.cpp b/tests/test_launcher_controller.cpp index 22d197b2d..729546753 100644 --- a/tests/test_launcher_controller.cpp +++ b/tests/test_launcher_controller.cpp @@ -222,7 +222,7 @@ protected: { auto const& model = Impl()->model_; auto icon = std::find_if(model->begin(), model->end(), - [&path](AbstractLauncherIcon::Ptr const& i) { return ( i->DesktopFile() == path); }); + [&path](AbstractLauncherIcon::Ptr const& i) { return (i->DesktopFile() == path); }); if (icon != model->end()) return *icon; @@ -287,13 +287,18 @@ TEST_F(TestLauncherController, Construction) for (auto const& fav_uri : favorite_store.GetFavorites()) { auto model_icon_it = std::find_if(lc.Impl()->model_->begin(), lc.Impl()->model_->end(), - [&fav_uri](AbstractLauncherIcon::Ptr const& i) { return (i->RemoteUri() == fav_uri); }); - auto const& icon_it = *model_icon_it; + [&fav_uri](AbstractLauncherIcon::Ptr const& i) { return (i->RemoteUri() == fav_uri); }); + bool valid_iter = (model_icon_it != lc.Impl()->model_->end()); if (fav_uri == places::APPS_URI || fav_uri == places::DEVICES_URI) - ASSERT_FALSE(icon_it.IsValid()); + { + ASSERT_FALSE(valid_iter); + } else - ASSERT_TRUE(icon_it.IsValid()); + { + ASSERT_TRUE(valid_iter); + ASSERT_TRUE(model_icon_it->IsValid()); + } } } @@ -711,8 +716,10 @@ TEST_F(TestLauncherController, AddRunningApps) if (!BAMF_IS_APPLICATION(l->data)) continue; - BamfApplication* app = BAMF_APPLICATION(l->data); + if (bamf_view_is_sticky(BAMF_VIEW(l->data))) + continue; + BamfApplication* app = BAMF_APPLICATION(l->data); ASSERT_NE(g_object_get_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen")), nullptr); auto desktop = bamf_application_get_desktop_file(app); @@ -755,9 +762,9 @@ TEST_F(TestLauncherController, SetupIcons) FavoriteStore::URI_PREFIX_APP + app::SW_CENTER, places::DEVICES_URI, FavoriteStore::URI_PREFIX_APP + app::UPDATE_MANAGER }); - std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free); lc.Impl()->SetupIcons(); lc.DisconnectSignals(); + std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free); auto fav = lc.Impl()->GetIconByUri(FavoriteStore::URI_PREFIX_APP + app::UBUNTU_ONE); EXPECT_EQ(model->IconIndex(fav), icon_index); @@ -771,12 +778,14 @@ TEST_F(TestLauncherController, SetupIcons) fav = lc.Impl()->GetIconByUri(FavoriteStore::URI_PREFIX_APP + app::UPDATE_MANAGER); EXPECT_EQ(model->IconIndex(fav), ++icon_index); - for (GList *l = apps.get(); l; l = l->next) { if (!BAMF_IS_APPLICATION(l->data)) continue; + if (bamf_view_is_sticky(BAMF_VIEW(l->data))) + continue; + auto desktop = bamf_application_get_desktop_file(BAMF_APPLICATION(l->data)); std::string path(desktop ? desktop : ""); ++icon_index; @@ -784,9 +793,7 @@ TEST_F(TestLauncherController, SetupIcons) if (path.empty()) continue; - auto const& icon = lc.GetIconByDesktop(path); - - ASSERT_TRUE(icon.IsValid()); + auto icon = lc.GetIconByDesktop(path); ASSERT_EQ(model->IconIndex(icon), icon_index); } @@ -801,9 +808,9 @@ TEST_F(TestLauncherController, ResetIconPriorities) favorite_store.AddFavorite(places::APPS_URI, -1); favorite_store.AddFavorite(places::DEVICES_URI, -1); - std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free); lc.Impl()->SetupIcons(); lc.DisconnectSignals(); + std::shared_ptr<GList> apps(bamf_matcher_get_applications(lc.Impl()->matcher_), g_list_free); favorite_store.SetFavorites({ places::DEVICES_URI, FavoriteStore::URI_PREFIX_APP + app::SW_CENTER, @@ -825,6 +832,9 @@ TEST_F(TestLauncherController, ResetIconPriorities) if (!BAMF_IS_APPLICATION(l->data)) continue; + if (bamf_view_is_sticky(BAMF_VIEW(l->data))) + continue; + auto desktop = bamf_application_get_desktop_file(BAMF_APPLICATION(l->data)); std::string path(desktop ? desktop : ""); ++icon_index; @@ -1516,7 +1526,9 @@ TEST_F(TestLauncherController, UpdateSelectionChanged) { UBusManager manager; std::string last_selection_change; - manager.RegisterInterest(UBUS_LAUNCHER_SELECTION_CHANGED, [&] (GVariant *data) { last_selection_change = g_variant_get_string(data, 0); }); + manager.RegisterInterest(UBUS_LAUNCHER_SELECTION_CHANGED, [&] (GVariant *data) { + last_selection_change = g_variant_get_string(data, 0); + }); lc.KeyNavGrab(); ProcessUBusMessages(); |
