|
1 /* |
|
2 * Copyright (c) 2010 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: Unit test for satappmainhandler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <hbmainwindow.h> |
|
20 #include <centralrepository.h> |
|
21 #include <coreapplicationuissdkcrkeys.h> |
|
22 #include "ut_satappmainhandler.h" |
|
23 //test class |
|
24 #include "satappmainhandler.h" |
|
25 #include "satappconstant.h" |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // Ut_SatAppMainHandler::Ut_SatAppMainHandler |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 Ut_SatAppMainHandler::Ut_SatAppMainHandler( |
|
32 HbMainWindow* mainWindow, QObject *parent) |
|
33 :QObject(parent), mMainWindow(mainWindow) |
|
34 { |
|
35 qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler >"); |
|
36 qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler <"); |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // Ut_SatAppMainHandler::~Ut_SatAppMainHandler |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 Ut_SatAppMainHandler::~Ut_SatAppMainHandler() |
|
44 { |
|
45 qDebug("Ut_SatAppMainHandler::~Ut_SatAppMainHandler >"); |
|
46 qDebug("Ut_SatAppMainHandler::~Ut_SatAppMainHandler <"); |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // Ut_SatAppMainHandler::initTestCase |
|
51 // QTestLib cleanup method, called after the last testfunction . |
|
52 // ----------------------------------------------------------------------------- |
|
53 void Ut_SatAppMainHandler::initTestCase() |
|
54 { |
|
55 qDebug("Ut_SatAppMainHandler::initTestCase >"); |
|
56 qDebug("Ut_SatAppMainHandler::initTestCase <"); |
|
57 } |
|
58 |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // Ut_SatAppMainHandler::cleanupTestCase |
|
62 // |
|
63 // Connects to test object signal and verifies received data. |
|
64 // ----------------------------------------------------------------------------- |
|
65 void Ut_SatAppMainHandler::cleanupTestCase() |
|
66 { |
|
67 qDebug("Ut_SatAppMainHandler::cleanupTestCase >"); |
|
68 if (mMainHandler) { |
|
69 qDebug("Ut_SatAppMainHandler::cleanupTestCase delete mMainHandler..."); |
|
70 delete mMainHandler; |
|
71 mMainHandler = 0; |
|
72 } |
|
73 qDebug("Ut_SatAppMainHandler::cleanupTestCase <"); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // Ut_SatAppMainHandler::testCreateMainHandler |
|
78 // |
|
79 // Connects to test object signal and verifies received data. |
|
80 // ----------------------------------------------------------------------------- |
|
81 void Ut_SatAppMainHandler::testCreateMainHandler() |
|
82 { |
|
83 qDebug("Ut_SatAppMainHandler::testCreateMainHandler >"); |
|
84 mMainHandler = new SatAppMainHandler(*mMainWindow); |
|
85 QVERIFY(mMainHandler); |
|
86 qDebug("Ut_SatAppMainHandler::testCreateMainHandler <"); |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode |
|
91 // |
|
92 // Connects to test object signal and verifies received data. |
|
93 // ----------------------------------------------------------------------------- |
|
94 void Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode() |
|
95 { |
|
96 qDebug("Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode >"); |
|
97 cleanupTestCase(); |
|
98 TInt profileId(0); |
|
99 CRepository* cr (NULL); |
|
100 TRAPD(err, cr = CRepository::NewL(KCRUidCoreApplicationUIs)); |
|
101 if ( KErrNone == err ) |
|
102 { |
|
103 // Get the ID of the currently active profile: |
|
104 TInt error = cr->Get(KCoreAppUIsNetworkConnectionAllowed, profileId); |
|
105 qDebug("Ut_SatAppMainHandler::SatAppMainHandler get active \ |
|
106 profile error=%d, profileId=%d", error, profileId); |
|
107 if( KErrNone != error){ |
|
108 delete cr; |
|
109 return; |
|
110 } |
|
111 error = cr->Set(KCoreAppUIsNetworkConnectionAllowed, |
|
112 ECoreAppUIsNetworkConnectionNotAllowed); |
|
113 qDebug("Ut_SatAppMainHandler::SatAppMainHandler set active \ |
|
114 profile error=%d",error); |
|
115 mMainHandler = new SatAppMainHandler(*mMainWindow); |
|
116 QVERIFY(mMainHandler); |
|
117 error = cr->Set(KCoreAppUIsNetworkConnectionAllowed, profileId); |
|
118 qDebug("Ut_SatAppMainHandler::SatAppMainHandler set active \ |
|
119 profile error=%d",error); |
|
120 delete cr; |
|
121 } |
|
122 |
|
123 qDebug("Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode <"); |
|
124 } |
|
125 // End of file |