summaryrefslogtreecommitdiff
diff options
-rw-r--r--launcher/SwitcherModel.cpp11
-rw-r--r--tests/test_switcher_controller.cpp2
-rw-r--r--tests/test_switcher_controller.h1
-rw-r--r--tests/test_switcher_controller_class.cpp5
-rw-r--r--tests/test_switcher_view.cpp4
5 files changed, 14 insertions, 9 deletions
diff --git a/launcher/SwitcherModel.cpp b/launcher/SwitcherModel.cpp
index b38ab766e..2b17d0da4 100644
--- a/launcher/SwitcherModel.cpp
+++ b/launcher/SwitcherModel.cpp
@@ -105,7 +105,7 @@ void SwitcherModel::VerifyApplications()
{
if (!(*it)->ShowInSwitcher(only_apps_on_viewport))
{
- auto icon_index = it - applications_.begin();
+ unsigned icon_index = it - applications_.begin();
hidden_applications_.push_back(*it);
it = applications_.erase(it);
anything_changed = true;
@@ -150,7 +150,7 @@ void SwitcherModel::InsertIcon(AbstractLauncherIcon::Ptr const& application)
if (sort_by_priority_)
{
auto pos = std::upper_bound(applications_.begin(), applications_.end(), application, CompareSwitcherItemsPriority);
- auto icon_index = pos - applications_.begin();
+ unsigned icon_index = pos - applications_.begin();
applications_.insert(pos, application);
if (icon_index <= index_)
@@ -197,7 +197,7 @@ void SwitcherModel::RemoveIcon(launcher::AbstractLauncherIcon::Ptr const& icon)
auto icon_it = std::find(applications_.begin(), applications_.end(), icon);
if (icon_it != applications_.end())
{
- auto icon_index = icon_it - applications_.begin();
+ unsigned icon_index = icon_it - applications_.begin();
bool was_in_detail = (detail_selection && icon_index == index_);
applications_.erase(icon_it);
@@ -466,7 +466,7 @@ void SwitcherModel::NextDetailRow()
if (!DetailIndexInLeftHalfOfRow())
increment = next_row;
- detail_selection_index = (detail_selection_index + increment) % DetailXids().size();
+ detail_selection_index = detail_selection_index + increment;
++row_index_;
}
else
@@ -486,8 +486,7 @@ void SwitcherModel::PrevDetailRow()
if (DetailIndexInLeftHalfOfRow())
decrement = prev_row;
- int selection_index = detail_selection_index - decrement;
- detail_selection_index = (selection_index > 0) ? selection_index : selection_index + DetailXids().size();
+ detail_selection_index = detail_selection_index - decrement;
row_index_--;
}
else
diff --git a/tests/test_switcher_controller.cpp b/tests/test_switcher_controller.cpp
index 384897f2c..e63a80213 100644
--- a/tests/test_switcher_controller.cpp
+++ b/tests/test_switcher_controller.cpp
@@ -125,7 +125,7 @@ TEST_F(TestSwitcherController, StartDetailModeMovesNextRows)
// 0, 1,
// 2, 3
EXPECT_TRUE(model->HasPrevDetailRow());
- EXPECT_EQ(static_cast<unsigned int>(model->detail_selection_index), 2);
+ EXPECT_EQ(model->detail_selection_index(), 2);
}
TEST_F(TestSwitcherController, StopDetailModeMovesPrevRows)
diff --git a/tests/test_switcher_controller.h b/tests/test_switcher_controller.h
index 474966732..bc0118df4 100644
--- a/tests/test_switcher_controller.h
+++ b/tests/test_switcher_controller.h
@@ -75,6 +75,7 @@ struct FakeLauncherIcon : unity::launcher::SimpleLauncherIcon
unity::WindowList Windows() override;
bool AllowDetailViewInSwitcher() const override;
+ bool ShowInSwitcher(bool) override;
uint64_t SwitcherPriority() override;
bool allow_detail_view_;
diff --git a/tests/test_switcher_controller_class.cpp b/tests/test_switcher_controller_class.cpp
index 8e7834839..749359f54 100644
--- a/tests/test_switcher_controller_class.cpp
+++ b/tests/test_switcher_controller_class.cpp
@@ -64,6 +64,11 @@ WindowList FakeLauncherIcon::Windows()
return window_list;
}
+bool FakeLauncherIcon::ShowInSwitcher(bool)
+{
+ return true;
+}
+
bool FakeLauncherIcon::AllowDetailViewInSwitcher() const
{
return allow_detail_view_;
diff --git a/tests/test_switcher_view.cpp b/tests/test_switcher_view.cpp
index 2ce9926b3..ef420f866 100644
--- a/tests/test_switcher_view.cpp
+++ b/tests/test_switcher_view.cpp
@@ -96,7 +96,7 @@ struct TestSwitcherView : testing::Test
SwitcherModel::Applications apps;
apps.push_back(AbstractLauncherIcon::Ptr(app));
- switcher.SetModel(std::make_shared<SwitcherModel>(apps));
+ switcher.SetModel(std::make_shared<SwitcherModel>(apps, true));
return apps[0];
}
@@ -130,7 +130,7 @@ TEST_F(TestSwitcherView, SetModel)
apps.push_back(AbstractLauncherIcon::Ptr(new MockLauncherIcon()));
apps.push_back(AbstractLauncherIcon::Ptr(new MockLauncherIcon()));
apps.push_back(AbstractLauncherIcon::Ptr(new MockLauncherIcon()));
- auto model = std::make_shared<SwitcherModel>(apps);
+ auto model = std::make_shared<SwitcherModel>(apps, false);
switcher.SetModel(model);
ASSERT_EQ(switcher.model_, model);