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,
22 #include <QtTest/QtTest>
26 #include "ui/mapviewscreen.h"
27 #include "ui/listviewscreen.h"
28 #include "ui/mainwindow.h"
29 //#include "facebook_service/fbauthentication/fbauthentication.h"
31 class testMainWindow : public QObject
35 void testViewSwitch();
36 void verifyStackItems();
37 // void verifyMenuItems(); //NON-WORKING
40 void testMainWindow::testViewSwitch()
42 MainWindow mainwindow;
43 QStackedWidget *m_testStack = dynamic_cast<QStackedWidget*>(mainwindow.centralWidget());
44 mainwindow.toListView();
45 QCOMPARE(m_testStack->currentIndex(), 0);
46 QCOMPARE(mainwindow.windowTitle(),QString(tr("List view")));
47 mainwindow.toMapView();
48 QCOMPARE(m_testStack->currentIndex(), 1);
49 QCOMPARE(mainwindow.windowTitle(),QString(tr("Map view")));
50 mainwindow.toMapView();
51 QCOMPARE(m_testStack->currentIndex(), 1);
52 QCOMPARE(mainwindow.windowTitle(),QString(tr("Map view")));
53 mainwindow.toListView();
54 QCOMPARE(m_testStack->currentIndex(), 0);
55 QCOMPARE(mainwindow.windowTitle(),QString(tr("List view")));
57 void testMainWindow::verifyStackItems()
59 MainWindow mainwindow;
60 QStackedWidget *m_testStack = dynamic_cast<QStackedWidget*>(mainwindow.centralWidget());
61 QCOMPARE(m_testStack->count(), 2);
62 QCOMPARE(m_testStack->widget(0)->objectName(),QString(tr("List view")));
63 QCOMPARE(m_testStack->widget(1)->objectName(),QString(tr("Map view")));
67 void testMainWindow::verifyMenuItems()
69 MainWindow mainwindow;
70 QWidget *m_testMenu = mainwindow.menuWidget();
71 qDebug() << m_testMenu->actions();
75 QTEST_MAIN(testMainWindow)
76 #include "mainwindow_test.moc"