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