Added missing files from the previous commit *sigh*
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Wed, 11 Aug 2010 14:20:39 +0000 (17:20 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Wed, 11 Aug 2010 14:20:39 +0000 (17:20 +0300)
tests/ui/tabbedpanel/tabbedpanel.pro [new file with mode: 0644]
tests/ui/tabbedpanel/testtabbedpanel.cpp [new file with mode: 0644]

diff --git a/tests/ui/tabbedpanel/tabbedpanel.pro b/tests/ui/tabbedpanel/tabbedpanel.pro
new file mode 100644 (file)
index 0000000..3441e61
--- /dev/null
@@ -0,0 +1,20 @@
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET +=
+DEPENDPATH += .
+INCLUDEPATH += "../../../src"
+SOURCES += \
+    testtabbedpanel.cpp \
+    ../../../src/ui/tabbedpanel.cpp \
+    ../../../src/ui/panelbar.cpp \
+    ../../../src/ui/panelbase.cpp \
+    ../../../src/ui/panelcontent.cpp \
+    ../../../src/ui/paneltab.cpp
+HEADERS += \
+    ../../../src/ui/tabbedpanel.h \
+    ../../../src/ui/panelbar.h \
+    ../../../src/ui/panelbase.h \
+    ../../../src/ui/panelcontent.h \
+    ../../../src/ui/paneltab.h \
+    ../../../src/ui/panelcommon.h
+DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/tests/ui/tabbedpanel/testtabbedpanel.cpp b/tests/ui/tabbedpanel/testtabbedpanel.cpp
new file mode 100644 (file)
index 0000000..6dc7345
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY 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
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+*/
+
+#include <QtTest/QtTest>
+#include <QtCore>
+
+#include "ui/tabbedpanel.h"
+
+class TestTabbedPanel : public QObject
+{
+    Q_OBJECT
+
+private slots:
+//    void testPanelTypes();
+    void testPanelToggling();
+};
+
+//void TestTabbedPanel::testPanelTypes()
+//{
+//    SidePanel *testPanel = new SidePanel();
+//    testPanel->setType(SidePanel::UserPanel);
+//    QCOMPARE(testPanel->objectName(), QString("UserPanel"));
+//    delete testPanel;
+
+//    testPanel = new SidePanel();
+//    testPanel->setType(SidePanel::FriendPanel);
+//    QCOMPARE(testPanel->objectName(), QString("FriendPanel"));
+//    delete testPanel;
+//}
+
+void TestTabbedPanel::testPanelToggling()
+{
+    TabbedPanel *testPanel = new TabbedPanel();
+
+    QSignalSpy toggleSpy(testPanel, SIGNAL(toggleState()));
+
+    QVERIFY(toggleSpy.isValid());
+    QCOMPARE(toggleSpy.count(),0);
+
+    //Try to close the panel. As the panel is closed, no toggle signal should be sent
+    testPanel->closePanel();
+    QTest::qWait(1);
+    QCOMPARE(toggleSpy.count(),0);
+
+    //Now try to open the panel. Signal should be sent
+    testPanel->openPanel();
+    QTest::qWait(1);
+    QCOMPARE(toggleSpy.count(), 1);
+
+    //Now try to open the panel again. Signal should not be sent as the panel is already open
+    testPanel->openPanel();
+    QTest::qWait(1);
+    QCOMPARE(toggleSpy.count(), 1);
+
+    //Now try to close the panel, signal should be sent
+    testPanel->closePanel();
+    QTest::qWait(1);
+    QCOMPARE(toggleSpy.count(), 2);
+    delete testPanel;
+}
+QTEST_MAIN(TestTabbedPanel)
+#include "testtabbedpanel.moc"