|
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: Main test class for hsHomeScreenStatePlugin library. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QStateMachine> |
|
19 |
|
20 #include "hsmenuworkerstate.h" |
|
21 #include "hsviewappsettingsstate.h" |
|
22 |
|
23 #include "t_hsmenuworkerstateplugin.h" |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 void MenuStatesTest::ViewAppSettings_construction() |
|
29 { |
|
30 #ifdef Q_OS_SYMBIAN |
|
31 #ifdef UT_MEMORY_CHECK |
|
32 __UHEAP_MARK; |
|
33 #endif//UT_MEMORY_CHECK |
|
34 #endif//Q_OS_SYMBIAN |
|
35 { |
|
36 HsMenuWorkerState parentState1; |
|
37 |
|
38 HsViewAppSettingsState vas1(&parentState1); |
|
39 QString s1 = vas1.objectName(); |
|
40 QVERIFY(s1 == tr("homescreen.nokia.com/state/MenuWorkerState/ViewAppSettingsState")); |
|
41 |
|
42 } |
|
43 #ifdef Q_OS_SYMBIAN |
|
44 #ifdef UT_MEMORY_CHECK |
|
45 __UHEAP_MARKEND; |
|
46 #endif//UT_MEMORY_CHECK |
|
47 #endif//Q_OS_SYMBIAN |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 void MenuStatesTest::ViewAppSettings_onEntry() |
|
54 { |
|
55 #ifdef Q_OS_SYMBIAN |
|
56 #ifdef UT_MEMORY_CHECK |
|
57 __UHEAP_MARK; |
|
58 #endif//UT_MEMORY_CHECK |
|
59 #endif//Q_OS_SYMBIAN |
|
60 { |
|
61 HsMenuWorkerState parentState1; |
|
62 HsViewAppSettingsState viewAppSettingsState(&parentState1); |
|
63 |
|
64 const QString javaSettingsPlugin("dumy/resource/qt/plugins/appsettings/javaapplicationsettingsview.qtplugin"); |
|
65 const QString javaAppUid("269636027"); |
|
66 CaEntry item( ItemEntryRole ); |
|
67 item.setText( "TestJavaApp" ); |
|
68 item.setEntryTypeName(Hs::applicationTypeName); |
|
69 //item.setAttribute(Hs::applicationUidEntryKey, javaAppUid); |
|
70 item.setAttribute(Hs::appSettingsPlugin, javaSettingsPlugin); |
|
71 QSharedPointer<CaEntry> newItem = CaService::instance()->createEntry( item ); |
|
72 QVERIFY(!newItem.isNull()); |
|
73 QVERIFY(newItem->id()); |
|
74 |
|
75 QVariantMap eventAttributes; |
|
76 eventAttributes.insert(Hs::itemIdKey, newItem->id()); |
|
77 |
|
78 HsMenuEvent *viewAppSettingsEvent = |
|
79 new HsMenuEvent(HsMenuEvent::ShowAppSettings, eventAttributes); |
|
80 |
|
81 viewAppSettingsState.onEntry(viewAppSettingsEvent); |
|
82 |
|
83 QVERIFY(CaService::instance()->removeEntry(newItem->id())); |
|
84 |
|
85 delete viewAppSettingsEvent; |
|
86 |
|
87 } |
|
88 #ifdef Q_OS_SYMBIAN |
|
89 #ifdef UT_MEMORY_CHECK |
|
90 __UHEAP_MARKEND; |
|
91 #endif//UT_MEMORY_CHECK |
|
92 #endif//Q_OS_SYMBIAN |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void MenuStatesTest::ViewAppSettings_onExit() |
|
100 { |
|
101 #ifdef Q_OS_SYMBIAN |
|
102 #ifdef UT_MEMORY_CHECK |
|
103 __UHEAP_MARK; |
|
104 #endif//UT_MEMORY_CHECK |
|
105 #endif//Q_OS_SYMBIAN |
|
106 { |
|
107 QState *parent = new QState(); |
|
108 HsViewAppSettingsState *viewAppSettingsState = new HsViewAppSettingsState(parent); |
|
109 |
|
110 QEvent *event = new QEvent(QEvent::StateMachineSignal); |
|
111 viewAppSettingsState->onExit(event); |
|
112 delete event; |
|
113 delete viewAppSettingsState; |
|
114 delete parent; |
|
115 } |
|
116 #ifdef Q_OS_SYMBIAN |
|
117 #ifdef UT_MEMORY_CHECK |
|
118 __UHEAP_MARKEND; |
|
119 #endif//UT_MEMORY_CHECK |
|
120 #endif//Q_OS_SYMBIAN |
|
121 } |
|
122 |