2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Kaj Wallin - kaj.wallin@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 #include <QtTest/QtTest>
26 #include "ui/sidepanel.h"
28 class TestSidePanel : public QObject
33 void testPanelTypes();
34 void testPanelToggling();
37 void TestSidePanel::testPanelTypes()
39 SidePanel *testPanel = new SidePanel();
40 testPanel->setType(SidePanel::UserPanel);
41 QCOMPARE(testPanel->objectName(), QString("UserPanel"));
44 testPanel = new SidePanel();
45 testPanel->setType(SidePanel::FriendPanel);
46 QCOMPARE(testPanel->objectName(), QString("FriendPanel"));
50 void TestSidePanel::testPanelToggling()
52 SidePanel *testPanel = new SidePanel();
53 testPanel->setType(SidePanel::UserPanel);
54 QSignalSpy toggleSpy(testPanel, SIGNAL(toggleState()));
56 QVERIFY(toggleSpy.isValid());
57 QCOMPARE(toggleSpy.count(),0);
59 //Try to close the panel. As the panel is closed, no toggle signal should be sent
60 testPanel->closePanel();
62 QCOMPARE(toggleSpy.count(),0);
64 //Now try to open the panel. Signal should be sent
65 testPanel->openPanel();
67 QCOMPARE(toggleSpy.count(), 1);
69 //Now try to open the panel again. Signal should not be sent as the panel is already open
70 testPanel->openPanel();
72 QCOMPARE(toggleSpy.count(), 1);
74 //Now try to close the panel, signal should be sent
75 testPanel->closePanel();
77 QCOMPARE(toggleSpy.count(), 2);
80 QTEST_MAIN(TestSidePanel)
81 #include "testsidepanel.moc"