Mercurial > trustbridge
annotate ui/tests/mainwindowtest.cpp @ 683:05953583a738
Merged
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Mon, 30 Jun 2014 19:04:15 +0200 |
parents | 2fd4f9980a2a |
children | a43ebf716abd |
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 |
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
559
diff
changeset
|
31 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
|
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); |