author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:33:21 +0100 | |
branch | GCC_SURGE |
changeset 51 | f39ed5e045e0 |
parent 22 | 6bb1b21d2484 |
parent 45 | 6b911d05207e |
permissions | -rw-r--r-- |
37 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef QTESTMAINS60 |
|
19 |
#define QTESTMAINS60 |
|
20 |
||
21 |
#include <hbapplication.h> |
|
22 |
#include <hbmainwindow.h> |
|
23 |
||
24 |
char *new_argv[3]; |
|
25 |
HbMainWindow *mainWindow; |
|
26 |
#define QTEST_MAIN_S60UI(TestObject) \ |
|
27 |
int main(int argc, char *argv[]) \ |
|
28 |
{ \ |
|
29 |
HbApplication *app = new HbApplication(argc, argv); \ |
|
30 |
QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; \ |
|
31 |
QByteArray bytes = str.toAscii(); \ |
|
32 |
\ |
|
33 |
char arg1[] = "-o"; \ |
|
34 |
\ |
|
35 |
new_argv[0] = argv[0]; \ |
|
36 |
new_argv[1] = arg1; \ |
|
37 |
new_argv[2] = bytes.data(); \ |
|
38 |
\ |
|
39 |
TestObject tc; \ |
|
40 |
QResource::registerResource("../hbcore.rcc"); \ |
|
41 |
mainWindow = new HbMainWindow;\ |
|
42 |
mainWindow->show(); \ |
|
43 |
int ret = QTest::qExec(&tc, 3, new_argv); \ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
44 |
/* Core dump if HbIconLoader instance is not destroyed before the application instance. */ \ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
45 |
/* HbIconLoader uses QCoreApplication::aboutToQuit() signal to destroy itself. */ \ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
46 |
/* app.exec() where the signal is normally emitted is not called here. */ \ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
47 |
/* So, invoking the signal explicitly. */ \ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
48 |
QMetaObject::invokeMethod(app, "aboutToQuit", Qt::DirectConnection); \ |
37 | 49 |
delete mainWindow; \ |
50 |
delete app; \ |
|
51 |
return ret; \ |
|
52 |
} |
|
53 |
||
54 |
#endif |