summaryrefslogtreecommitdiff
path: root/tests
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2015-12-16 03:17:58 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2015-12-16 03:17:58 +0100
commite72388a1ce56c56ee806427dda97497221101a54 (patch)
tree502e37e8b6cac22617e62c9a95f7c946b4ff5923 /tests
parentefb2acffcf525256060525ae2eca1cedf8847e74 (diff)
TestSwitcherModel: add test to verify DetailXids and SelectionWindows
Fix failing test due to DetailXids change (bzr r4054.4.3)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_switcher_model.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/test_switcher_model.cpp b/tests/test_switcher_model.cpp
index c02e9dcee..558514140 100644
--- a/tests/test_switcher_model.cpp
+++ b/tests/test_switcher_model.cpp
@@ -79,7 +79,10 @@ TEST_F(TestSwitcherModel, TestConstructor)
EXPECT_EQ(model->LastSelection(), icons_.front());
EXPECT_EQ(model->SelectionIndex(), 0);
EXPECT_EQ(model->LastSelectionIndex(), 0);
- EXPECT_EQ(static_cast<unsigned int>(model->detail_selection_index), 0);
+ EXPECT_FALSE(model->SelectionWindows().empty());
+ EXPECT_TRUE(model->DetailXids().empty());
+ EXPECT_FALSE(model->detail_selection);
+ EXPECT_EQ(model->detail_selection_index, 0u);
}
@@ -154,10 +157,22 @@ TEST_F(TestSwitcherModel, SelectionIsActive)
EXPECT_TRUE(model->SelectionIsActive());
}
+TEST_F(TestSwitcherModel, DetailXidsIsValidOnSelectionOnly)
+{
+ model->detail_selection = true;
+ EXPECT_FALSE(model->DetailXids().empty());
+ EXPECT_EQ(model->DetailXids(), model->SelectionWindows());
+
+ model->detail_selection = false;
+ EXPECT_TRUE(model->DetailXids().empty());
+ EXPECT_FALSE(model->SelectionWindows().empty());
+}
+
TEST_F(TestSwitcherModel, TestWebAppActive)
{
// Create a base case
auto base_model = std::make_shared<SwitcherModel>(icons_, false);
+ base_model->detail_selection = true;
// Set the first icon as Active to simulate Firefox being active
icons_.front()->SetQuirk(AbstractLauncherIcon::Quirk::ACTIVE, true);
@@ -166,7 +181,7 @@ TEST_F(TestSwitcherModel, TestWebAppActive)
icons_.back()->SetQuirk(AbstractLauncherIcon::Quirk::ACTIVE, true);
auto new_model = std::make_shared<SwitcherModel>(icons_, false);
- new_model->DetailXids();
+ new_model->detail_selection = true;
// model's front Window should be different than the base case due to the
// re-sorting in DetailXids().