1 /* |
|
2 * Copyright (c) 2006-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: test case |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 #include <w32std.h> |
|
27 #include <coecntrl.h> |
|
28 |
|
29 #include "BCTestMemSelPage.h" |
|
30 #include "BCTestCmDlg.hrh" |
|
31 #include "streamlogger.h" |
|
32 |
|
33 // ======== MEMBER FUNCTIONS ======== |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // Symbian 2nd static Constructor |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CBCTestMemSelSettingPage* CBCTestMemSelSettingPage::NewL() |
|
40 { |
|
41 CBCTestMemSelSettingPage* self = new( ELeave ) CBCTestMemSelSettingPage(); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // C++ default constructor |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CBCTestMemSelSettingPage::CBCTestMemSelSettingPage():iDlg(0) |
|
53 { |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // Destructor |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 CBCTestMemSelSettingPage::~CBCTestMemSelSettingPage() |
|
61 { |
|
62 delete iDlg; |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // Symbian 2nd Constructor |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 void CBCTestMemSelSettingPage::ConstructL() |
|
70 { |
|
71 BuildScriptL(); |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CBCTestMemSelSettingPage::BuildScriptL |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CBCTestMemSelSettingPage::BuildScriptL() |
|
79 { |
|
80 AddTestL( DELAY(1), TEND); |
|
81 |
|
82 // Add script as your need. |
|
83 for(int i=0; i<EBCTestCmdMemSelPageEnd - EBCTestCmdMemSelPageBegin -1; ++i) |
|
84 { |
|
85 AddTestL( LeftCBA, REP(Down, 1), Right, TEND ); |
|
86 for(int j=0; j<i; ++j) |
|
87 AddTestL( Down, TEND); |
|
88 AddTestL( LeftCBA, TEND ); |
|
89 AddOKL(); |
|
90 } |
|
91 } |
|
92 |
|
93 void CBCTestMemSelSettingPage::AddOKL() |
|
94 { |
|
95 // add dlg response sciprts |
|
96 for(int i=0; i<1; ++i) |
|
97 AddTestL( WAIT(5), KeyOK, TEND); |
|
98 } |
|
99 |
|
100 void CBCTestMemSelSettingPage::AddCancelL() |
|
101 { |
|
102 // add dlg response sciprts |
|
103 for(int i=0; i<1; ++i) |
|
104 AddTestL( WAIT(5), RightCBA, TEND); |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CBCTestMemSelSettingPage::RunL |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 void CBCTestMemSelSettingPage::RunL( TInt aCmd ) |
|
112 { |
|
113 SetupL(); |
|
114 switch(aCmd){ |
|
115 case EBCTestCmdMemSelPageCreate: |
|
116 TestCreateL(); |
|
117 break; |
|
118 case EBCTestCmdMemSelPageCreateRes: |
|
119 TestCreateL(0); // 0 is default res id |
|
120 break; |
|
121 case EBCTestCmdMemSelPageQuickCreate: |
|
122 TestQuickCreateL(); |
|
123 break; |
|
124 case EBCTestCmdMemSelPageQuickCreateTitle: |
|
125 TestQuickCreateL(_L("a title")); |
|
126 break; |
|
127 case EBCTestCmdMemSelPageQuickCreateRes: |
|
128 TestQuickCreateL(0); // 0 is the default res id |
|
129 break; |
|
130 default: |
|
131 break; |
|
132 } |
|
133 Teardown(); |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CBCTestMemSelSettingPage::ReleaseCaseL |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 void CBCTestMemSelSettingPage::Teardown() |
|
141 { |
|
142 delete iDlg; |
|
143 iDlg = NULL; |
|
144 } |
|
145 |
|
146 void CBCTestMemSelSettingPage::TestCreateL() |
|
147 { |
|
148 _LIT( KRootPath, "C:\\Nokia\\Images\\" ); |
|
149 _LIT( KDefaultFileName, "DynamicFilename.jpg" ); |
|
150 TFileName emptyFileName( KNullDesC ); |
|
151 TFileName rootFileName( KRootPath ); |
|
152 TFileName defaultFileName( KDefaultFileName ); |
|
153 |
|
154 iDlg = CAknMemorySelectionSettingPage::NewL(); |
|
155 AssertNotNullL(iDlg, _L("mem sel setting page created")); |
|
156 |
|
157 TInt returnValue = iDlg->ExecuteL( iMemory, &rootFileName, &defaultFileName ); |
|
158 iDlg->GetItem( iMemory, emptyFileName ); |
|
159 |
|
160 TFileName msg; |
|
161 msg.Format( _L("User Hit: %d, Memory is: %d, FileName: "), returnValue, iMemory ); |
|
162 msg.Append( emptyFileName ); |
|
163 msg.ZeroTerminate(); |
|
164 AssertTrueL(ETrue, msg); |
|
165 msg.Append( _L("Root: ") ); |
|
166 msg.Append( rootFileName ); |
|
167 msg.Append( _L(", Default: ") ); |
|
168 msg.Append( defaultFileName ); |
|
169 msg.ZeroTerminate(); |
|
170 AssertTrueL(ETrue, msg); |
|
171 } |
|
172 |
|
173 void CBCTestMemSelSettingPage::TestCreateL(TInt aResID) |
|
174 { |
|
175 iDlg = CAknMemorySelectionSettingPage::NewL( aResID ); |
|
176 TInt returnValue = iDlg->ExecuteL( iMemory); |
|
177 AssertTrueL( returnValue, _L("Create with Resorce ID")); |
|
178 } |
|
179 |
|
180 void CBCTestMemSelSettingPage::TestQuickCreateL() |
|
181 { |
|
182 AssertTrueL(CAknMemorySelectionSettingPage::RunDlgLD(iMemory), _L("Quick create, User hit OK")); |
|
183 AssertIntL( CAknMemorySelectionSettingPage::EPhoneMemory, iMemory, _L("Phone memroy created")); |
|
184 } |
|
185 |
|
186 void CBCTestMemSelSettingPage::TestQuickCreateL(const TDesC &aTitle) |
|
187 { |
|
188 AssertTrueL(CAknMemorySelectionSettingPage::RunDlgLD(iMemory, aTitle), _L("Quick create with title, User hit OK")); |
|
189 AssertIntL( CAknMemorySelectionSettingPage::EPhoneMemory, iMemory, _L("Phone memroy created")); |
|
190 } |
|
191 |
|
192 void CBCTestMemSelSettingPage::TestQuickCreateL(TInt aResID) |
|
193 { |
|
194 AssertTrueL(CAknMemorySelectionSettingPage::RunDlgLD(iMemory, aResID), _L("Quick create with ResID, User hit OK")); |
|
195 AssertIntL( CAknMemorySelectionSettingPage::EPhoneMemory, iMemory, _L("Phone memroy created")); |
|
196 } |
|
197 |
|
198 void CBCTestMemSelSettingPage::SetupL() |
|
199 { |
|
200 iMemory = CAknMemorySelectionDialog::EPhoneMemory; |
|
201 } |
|
202 |
|