1 /* |
|
2 * Copyright (c) 2002 - 2007 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: Test CAknMemorySelectionSettingPage.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <testsdkcfd.rsg> |
|
20 |
|
21 #include "testsdkcfd.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CTestSDKCFD::TestSettingPageNewLNoParaL |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 TInt CTestSDKCFD::TestSettingPageNewLNoParaL( CStifItemParser& /*aItem*/ ) |
|
30 { |
|
31 _LIT( Ktestsdkcfd, "testsdkcfd" ); |
|
32 _LIT( KExample, "In TestSettingPageNewLNoPara" ); |
|
33 TestModuleIf().Printf( 0, Ktestsdkcfd, KExample ); |
|
34 iLog->Log( KExample ); |
|
35 |
|
36 CAknMemorySelectionSettingPage* pagepointer = CAknMemorySelectionSettingPage::NewL(); |
|
37 CleanupStack::PushL( pagepointer ); |
|
38 STIF_ASSERT_NOT_NULL( pagepointer ); |
|
39 CleanupStack::PopAndDestroy( pagepointer ); |
|
40 |
|
41 return KErrNone; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CTestSDKCFD::TestSettingPageNewL |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 TInt CTestSDKCFD::TestSettingPageNewL( CStifItemParser& /*aItem*/ ) |
|
49 { |
|
50 _LIT( Ktestsdkcfd, "testsdkcfd" ); |
|
51 _LIT( KNewL, "In TestSettingPageNewL" ); |
|
52 TestModuleIf().Printf( 0, Ktestsdkcfd, KNewL ); |
|
53 iLog->Log(KNewL); |
|
54 |
|
55 iSettingPage = CAknMemorySelectionSettingPage::NewL( R_TEST_MEMORY_SELECTION_DIALOG ); |
|
56 STIF_ASSERT_NOT_NULL( iSettingPage ); |
|
57 return KErrNone; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CTestSDKCFD::TestSettingPageExecuteLOnlyMemoryTypeL |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 TInt CTestSDKCFD::TestSettingPageExecuteLOnlyMemoryTypeL( CStifItemParser& aItem ) |
|
65 { |
|
66 _LIT( Ktestsdkcfd, "testsdkcfd" ); |
|
67 _LIT( KExample, "In TestSettingPageExecuteLOnlyMemoryType" ); |
|
68 TestModuleIf().Printf( 0, Ktestsdkcfd, KExample ); |
|
69 // Print to log file |
|
70 iLog->Log( KExample ); |
|
71 |
|
72 CAknMemorySelectionDialog::TMemory memorytype = CAknMemorySelectionDialog::EPhoneMemory; |
|
73 CAknCommonDialogsBase::TReturnKey returnkey; |
|
74 if( !iSettingPage ) |
|
75 { |
|
76 iSettingPage = CAknMemorySelectionSettingPage::NewL(); |
|
77 } |
|
78 |
|
79 TInt num = 0; |
|
80 TInt err = aItem.GetNextInt( num ); |
|
81 if( err != KErrNone) |
|
82 return err; |
|
83 switch ( num ) |
|
84 { |
|
85 case ECaseOne: |
|
86 { |
|
87 returnkey = iSettingPage->ExecuteL(memorytype); |
|
88 STIF_ASSERT_EQUALS( CAknCommonDialogsBase::ELeftSoftkey, returnkey ); |
|
89 STIF_ASSERT_EQUALS( CAknMemorySelectionDialog::EPhoneMemory, memorytype ); |
|
90 break; |
|
91 } |
|
92 case ECaseTwo: |
|
93 { |
|
94 returnkey = iSettingPage->ExecuteL(memorytype); |
|
95 STIF_ASSERT_EQUALS( CAknCommonDialogsBase::ERightSoftkey, returnkey ); |
|
96 STIF_ASSERT_EQUALS( CAknMemorySelectionDialog::EPhoneMemory, memorytype ); |
|
97 break; |
|
98 } |
|
99 case ECaseThree: |
|
100 { |
|
101 returnkey = iSettingPage->ExecuteL(memorytype); |
|
102 //ESelectionKey in TReturnKey can't be getten in here, ELeftSoftkey will be return |
|
103 STIF_ASSERT_EQUALS( CAknCommonDialogsBase::ELeftSoftkey, returnkey ); |
|
104 STIF_ASSERT_EQUALS( CAknMemorySelectionDialog::EPhoneMemory, memorytype ); |
|
105 break; |
|
106 } |
|
107 default: |
|
108 return KErrNotSupported; |
|
109 } |
|
110 |
|
111 _LIT( KFinished, "TestSettingPageExecuteLOnlyMemoryTypeL finished" ); |
|
112 TestModuleIf().Printf( 0, Ktestsdkcfd, KFinished ); |
|
113 iLog->Log( KFinished ); |
|
114 |
|
115 return KErrNone; |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CTestSDKCFD::TestSettingPageDeconstructor |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 TInt CTestSDKCFD::TestSettingPageDeconstructorL( CStifItemParser& /*aItem*/ ) |
|
123 { |
|
124 CAknMemorySelectionSettingPage* pagepointer = CAknMemorySelectionSettingPage::NewL(); |
|
125 CleanupStack::PushL( pagepointer ); |
|
126 STIF_ASSERT_NOT_NULL( pagepointer ); |
|
127 CleanupStack::PopAndDestroy( pagepointer ); |
|
128 |
|
129 return KErrNone; |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CTestSDKCFD::TestSettingPageRunDlgLDTwoParaL |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 TInt CTestSDKCFD::TestSettingPageRunDlgLDTwoParaL( CStifItemParser& aItem ) |
|
137 { |
|
138 _LIT( Ktestsdkcfd, "testsdkcfd" ); |
|
139 _LIT( KExample, "In TestSettingPageRunDlgLDTwoParaL" ); |
|
140 TestModuleIf().Printf( 0, Ktestsdkcfd, KExample ); |
|
141 iLog->Log( KExample ); |
|
142 |
|
143 CTestControl* control = CTestControl::NewL(); |
|
144 CleanupStack::PushL( control ); |
|
145 CCoeEnv::Static()->AppUi()->AddToStackL( control ); |
|
146 TInt err = control->TestSettingPageRunLDL( aItem ); |
|
147 CCoeEnv::Static()->AppUi()->RemoveFromStack( control ); |
|
148 CleanupStack::PopAndDestroy( control ); |
|
149 |
|
150 return err; |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CTestSDKCFD::TestSettingPageRunDlgLDThreeParaL |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 TInt CTestSDKCFD::TestSettingPageRunDlgLDThreeParaL( CStifItemParser& aItem ) |
|
158 { |
|
159 //can't get the title because the object will be destoried after display |
|
160 _LIT( Ktestsdkcfd, "testsdkcfd" ); |
|
161 _LIT( KExample, "In TestSettingPageRunDlgLDTwoParaL" ); |
|
162 TestModuleIf().Printf( 0, Ktestsdkcfd, KExample ); |
|
163 iLog->Log(KExample); |
|
164 |
|
165 CTestControl* control = CTestControl::NewL(); |
|
166 CleanupStack::PushL( control ); |
|
167 CCoeEnv::Static()->AppUi()->AddToStackL( control ); |
|
168 TInt err = control->TestSettingPageRunLDL( aItem ); |
|
169 CCoeEnv::Static()->AppUi()->RemoveFromStack( control ); |
|
170 CleanupStack::PopAndDestroy( control ); |
|
171 |
|
172 return err; |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CTestSDKCFD::TestSettingPageRunDlgLDFiveParaL |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 TInt CTestSDKCFD::TestSettingPageRunDlgLDFiveParaL( CStifItemParser& aItem ) |
|
180 { |
|
181 _LIT( Ktestsdkcfd, "testsdkcfd" ); |
|
182 _LIT( KExample, "In TestSettingPageRunDlgLDTwoParaL" ); |
|
183 TestModuleIf().Printf( 0, Ktestsdkcfd, KExample ); |
|
184 iLog->Log(KExample); |
|
185 |
|
186 CTestControl* control = CTestControl::NewL(); |
|
187 CleanupStack::PushL( control ); |
|
188 CCoeEnv::Static()->AppUi()->AddToStackL( control ); |
|
189 TInt err = control->TestSettingPageRunLDL( aItem ); |
|
190 CCoeEnv::Static()->AppUi()->RemoveFromStack( control ); |
|
191 CleanupStack::PopAndDestroy( control ); |
|
192 |
|
193 return err; |
|
194 } |
|
195 |
|
196 // End of File |
|