diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-03-20 10:59:24 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-03-20 10:59:24 +0100 |
| commit | 941528e1aa405626d946854b320aec7a44136f14 (patch) | |
| tree | 3ac0aab27435a7030f846a3f4df14d91d22e9a8a /tests/unit | |
| parent | 9fdb39e9a4f1e0df39f1f1f108f0cc452470220e (diff) | |
| parent | 9bd8ee9131c19469d001f0031462fa87d1c7278b (diff) | |
Merging with trunk
(bzr r1858.9.186)
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/TestSwitcherModel.cpp | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/tests/unit/TestSwitcherModel.cpp b/tests/unit/TestSwitcherModel.cpp deleted file mode 100644 index 43ac8ad96..000000000 --- a/tests/unit/TestSwitcherModel.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2011 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: Jason Smith <jason.smith@canonical.com> - * - */ - -#include <gtest/gtest.h> - -#include "SwitcherModel.h" -#include "MockLauncherIcon.h" - -#include <vector> - - -using namespace unity::switcher; - -namespace -{ - -TEST(TestSwitcher, TestConstructor) -{ - AbstractLauncherIcon* first = new MockLauncherIcon(); - AbstractLauncherIcon* second = new MockLauncherIcon(); - std::vector<AbstractLauncherIcon*> icons; - icons.push_back(first); - icons.push_back(second); - - SwitcherModel::Ptr model(new SwitcherModel(icons)); - - EXPECT_EQ(model->Size(), 2); - EXPECT_EQ(model->Selection(), first); - EXPECT_EQ(model->LastSelection(), first); - EXPECT_EQ(model->SelectionIndex(), 0); - EXPECT_EQ(model->LastSelectionIndex(), 0); - - delete first; - delete second; -} - -TEST(TestSwitcher, TestSelection) -{ - std::vector<AbstractLauncherIcon*> icons; - AbstractLauncherIcon* first = new MockLauncherIcon(); - AbstractLauncherIcon* second = new MockLauncherIcon(); - AbstractLauncherIcon* third = new MockLauncherIcon(); - AbstractLauncherIcon* fourth = new MockLauncherIcon(); - - icons.push_back(first); - icons.push_back(second); - icons.push_back(third); - icons.push_back(fourth); - - SwitcherModel::Ptr model(new SwitcherModel(icons)); - - EXPECT_EQ(model->Size(), 4); - EXPECT_EQ(model->Selection(), first); - - model->Next(); - EXPECT_EQ(model->Selection(), second); - EXPECT_EQ(model->LastSelection(), first); - model->Next(); - EXPECT_EQ(model->Selection(), third); - EXPECT_EQ(model->LastSelection(), second); - model->Next(); - EXPECT_EQ(model->Selection(), fourth); - EXPECT_EQ(model->LastSelection(), third); - model->Next(); - EXPECT_EQ(model->Selection(), first); - EXPECT_EQ(model->LastSelection(), fourth); - model->Next(); - EXPECT_EQ(model->Selection(), second); - EXPECT_EQ(model->LastSelection(), first); - model->Prev(); - EXPECT_EQ(model->Selection(), first); - EXPECT_EQ(model->LastSelection(), second); - model->Prev(); - EXPECT_EQ(model->Selection(), fourth); - EXPECT_EQ(model->LastSelection(), first); - - model->Select(2); - EXPECT_EQ(model->Selection(), third); - EXPECT_EQ(model->LastSelection(), fourth); - - model->Select(first); - EXPECT_EQ(model->Selection(), first); - EXPECT_EQ(model->LastSelection(), third); - - delete first; - delete second; - delete third; - delete fourth; -} - -} |
