annotate ui/tests/mainwindowtest.cpp @ 640:626507197360 trustbridge-refactor

Updated mainwindow and handle certificate lists.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 24 Jun 2014 17:07:49 +0200
parents aee3eb10bbba
children 2fd4f9980a2a
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::testInvalidUpdate() {
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
27 // TODO
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
28 }
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
29
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
30 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
31 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
32 #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
33 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
34 #else
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
35 installNewSW(QString::fromLatin1("fakeinst"), QDateTime::currentDateTime());
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
36 #endif
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 559
diff changeset
37 QVERIFY(closed.count() == 1);
559
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
38 }
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
39
dd8a295d5b4d Add framework for mainwindow testing
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
40 QTEST_MAIN(MainWindowTest);

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