|
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: Main test class for hsutils library. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <qservicemanager.h> |
|
20 #include <hbmainwindow.h> |
|
21 #include <hbinstance.h> |
|
22 #include "t_hsapplication.h" |
|
23 |
|
24 QTM_USE_NAMESPACE |
|
25 |
|
26 const QString xmlPath = "./hsresources/plugins/stateplugins/"; |
|
27 const QString mockedStatePluginsXml = "mockstateplugins.xml"; |
|
28 |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 void t_hsapplication::initTestCase() |
|
34 { |
|
35 //Let's add mocked test service to default interface implementation |
|
36 //before testcases are run. This trick is needed especially in Symbian side |
|
37 //since default runtime is also seen due to exported resources for hsapplication. |
|
38 QApplication::addLibraryPath(QDir(xmlPath).absolutePath()); |
|
39 QServiceManager manager; |
|
40 qDebug() << "t_hsapplication::initTestCase addService:" << manager.addService(xmlPath + mockedStatePluginsXml); |
|
41 |
|
42 qDebug() << "setInterfaceDefault(HsLoadSceneState): " << manager.setInterfaceDefault("mockstateplugins", "com.nokia.homescreen.state.HsLoadSceneState"); |
|
43 qDebug() << "setInterfaceDefault(HsIdleState): " << manager.setInterfaceDefault("mockstateplugins", "com.nokia.homescreen.state.HsIdleState"); |
|
44 qDebug() << "setInterfaceDefault(HsAppLibraryState): " << manager.setInterfaceDefault("mockstateplugins", "com.nokia.homescreen.state.HsAppLibraryState"); |
|
45 qDebug() << "setInterfaceDefault(HsMenuWorkerState): " << manager.setInterfaceDefault("mockstateplugins", "com.nokia.homescreen.state.HsMenuWorkerState"); |
|
46 qDebug() << "setInterfaceDefault(HsRootState): " << manager.setInterfaceDefault("mockstateplugins", "com.nokia.homescreen.state.HsRootState"); |
|
47 qDebug() << "setInterfaceDefault(HsBackupRestoreState): " << manager.setInterfaceDefault("mockstateplugins", "com.nokia.homescreen.state.HsBackupRestoreState"); |
|
48 |
|
49 HbInstance::instance(); |
|
50 mWindow = new HbMainWindow; |
|
51 #ifndef NFT |
|
52 // QDir::setCurrent("C:/hsresources/testresources"); |
|
53 #else |
|
54 // QDir::setCurrent("Z:/hsresources/testresources"); |
|
55 #endif |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 void t_hsapplication::cleanupTestCase() |
|
62 { |
|
63 QServiceManager manager; |
|
64 manager.removeService("mockstateplugins"); |
|
65 QApplication::removeLibraryPath(xmlPath); |
|
66 |
|
67 delete mWindow; |
|
68 mWindow = 0; |
|
69 } |
|
70 |
|
71 QTEST_MAIN(t_hsapplication) |