annotate ui/tests/mainwindowtest.cpp @ 1345:db9dfd4740af

Added tag 0.9.4 for changeset cf1cd6cda97b
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 28 Oct 2014 12:01:37 +0100
parents a43ebf716abd
children
rev   line source
559
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
3 *
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
6 * See LICENSE.txt for details.
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
7 */
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9 #include "mainwindowtest.h"
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
11 #include <QSignalSpy>
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
12
559
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
13 #ifdef Q_OS_WIN
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
14 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
15 #else
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
17 #endif
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
18
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
19 MainWindowTest::MainWindowTest() : MainWindow(true) {
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
20 }
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
21
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
22 void MainWindowTest::closeApp() {
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
23 emit closeCalled();
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
24 }
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
25
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
26 void MainWindowTest::testValidUpdate() {
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
27 QSignalSpy closed(this, SIGNAL(closeCalled()));
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
28 #ifdef Q_OS_WIN
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
29 installNewSW(QString::fromLatin1("c:/fakeinst.exe"), QDateTime::currentDateTime());
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
30 #else
875
a43ebf716abd With linux verification workin we need to verify the signed package.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 636
diff changeset
31 installNewSW(QString::fromLatin1("fakeinst-signed"), QDateTime::currentDateTime());
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
32 #endif
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
33 QVERIFY(closed.count() == 1);
559
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
34 }
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
35
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
36 QTEST_MAIN(MainWindowTest);

http://wald.intevation.org/projects/trustbridge/