3 Copyright (C) 2011 Luciano Montanaro <mikelima@cirulla.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 #include <QtCore/QString>
23 #include <QtTest/QtTest>
24 #include <QtCore/QCoreApplication>
26 #include "../application/stationlistmodel.h"
28 class AppTest : public QObject
37 void cleanupTestCase();
45 StationListModel *model;
51 model = new StationListModel(this);
52 path = QCoreApplication::applicationDirPath();
55 void AppTest::initTestCase()
59 void AppTest::cleanupTestCase()
63 void AppTest::testCase1()
65 QVERIFY2(false == model->load(path + "/testfiles/missing.qpl"), "File does not exist, should not return ok");
68 void AppTest::testCase2()
70 QVERIFY2(true == model->load(path + "/testfiles/empty.qpl"), "File cannot be loaeded");
71 QVERIFY2(0 == model->rowCount(), "Should be empty");
74 void AppTest::testCase3()
76 QVERIFY2(false == model->load(path + "/testfiles/malformed1.qpl"), "Tags are wrong, should not return ok");
79 void AppTest::testCase4()
81 QVERIFY2(true == model->load(path + "/testfiles/emptystation.qpl"), "cannot open file");
84 void AppTest::testCase5()
86 qDebug() << model->rowCount();
87 QVERIFY2(true == model->load(path + "/testfiles/teststation.qpl"), "cannot open file");
88 qDebug() << model->rowCount();
89 QVERIFY(model->rowCount() == 1);
90 QVERIFY(model->item(0)->text() == "Topolinia");
95 #include "tst_app.moc"