45
|
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 aknmultilinequerycontrol.h
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
//INCLUDE
|
|
19 |
#include <aknmultilinequerycontrol.h>
|
|
20 |
#include <aknquerydialog.h>
|
|
21 |
#include <testsdkqueries.rsg>
|
|
22 |
#include <barsread.h>
|
|
23 |
|
|
24 |
#include "testsdkqueries.h"
|
|
25 |
#include "testsdkaknquerydialogprotected.h"
|
|
26 |
|
|
27 |
const TInt KZero = 0;
|
|
28 |
const TInt KOne = 1;
|
|
29 |
const TInt KTwo = 2;
|
|
30 |
|
|
31 |
// -----------------------------------------------------------------------------
|
|
32 |
// CTestSDKQueries::TestMqdlgNewL
|
|
33 |
// -----------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
TInt CTestSDKQueries::TestMlqcConstructorL( CStifItemParser& /*aItem*/ )
|
|
36 |
{
|
|
37 |
CAknMultilineQueryControl* mQC = new( ELeave ) CAknMultilineQueryControl;
|
|
38 |
CleanupStack::PushL( mQC );
|
|
39 |
STIF_ASSERT_NOT_NULL( mQC );
|
|
40 |
CleanupStack::PopAndDestroy( mQC );
|
|
41 |
return KErrNone;
|
|
42 |
}
|
|
43 |
|
|
44 |
// -----------------------------------------------------------------------------
|
|
45 |
// CTestSDKQueries::TestMqdlgNewL
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
//
|
|
48 |
TInt CTestSDKQueries::TestMlqcDestructorL( CStifItemParser& /*aItem*/ )
|
|
49 |
{
|
|
50 |
CAknMultilineQueryControl* mQC = new( ELeave ) CAknMultilineQueryControl;
|
|
51 |
CleanupStack::PushL( mQC );
|
|
52 |
CleanupStack::PopAndDestroy( mQC );
|
|
53 |
return KErrNone;
|
|
54 |
}
|
|
55 |
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
// CTestSDKQueries::TestMqdlgNewL
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
TInt CTestSDKQueries::TestMlqcSetNbrOfPromptLinesL( CStifItemParser& /*aItem*/ )
|
|
61 |
{
|
|
62 |
CAknMultilineQueryControl* mQC = new( ELeave ) CAknMultilineQueryControl;
|
|
63 |
CleanupStack::PushL( mQC );
|
|
64 |
mQC->SetNbrOfPromptLines( KOne, KTwo );
|
|
65 |
CleanupStack::PopAndDestroy( mQC );
|
|
66 |
return KErrNone;
|
|
67 |
}
|
|
68 |
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
// CTestSDKQueries::TestMqdlgNewL
|
|
71 |
// -----------------------------------------------------------------------------
|
|
72 |
//
|
|
73 |
TInt CTestSDKQueries::TestMlqcIsFirstL( CStifItemParser& /*aItem*/ )
|
|
74 |
{
|
|
75 |
CAknMultilineQueryControl* mQC = new( ELeave ) CAknMultilineQueryControl;
|
|
76 |
CleanupStack::PushL( mQC );
|
|
77 |
TBool firstLine = mQC->IsFirst();
|
|
78 |
STIF_ASSERT_TRUE( firstLine );
|
|
79 |
CleanupStack::PopAndDestroy( mQC );
|
|
80 |
return KErrNone;
|
|
81 |
}
|
|
82 |
|
|
83 |
// -----------------------------------------------------------------------------
|
|
84 |
// CTestSDKQueries::TestMqdlgNewL
|
|
85 |
// -----------------------------------------------------------------------------
|
|
86 |
//
|
|
87 |
TInt CTestSDKQueries::TestMlqcIsSecondL( CStifItemParser& /*aItem*/ )
|
|
88 |
{
|
|
89 |
CAknMultilineQueryControl* mQC = new( ELeave ) CAknMultilineQueryControl;
|
|
90 |
CleanupStack::PushL( mQC );
|
|
91 |
TBool second = mQC->IsSecond();
|
|
92 |
STIF_ASSERT_FALSE( second );
|
|
93 |
CleanupStack::PopAndDestroy( mQC );
|
|
94 |
return KErrNone;
|
|
95 |
}
|
|
96 |
|
|
97 |
// -----------------------------------------------------------------------------
|
|
98 |
// CTestSDKQueries::TestMqdlgNewL
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
TInt CTestSDKQueries::TestMlqcControlByLayoutOrNullL( CStifItemParser& /*aItem*/ )
|
|
102 |
{
|
|
103 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );
|
|
104 |
dlg->PrepareLC( R_QUERY_DIALOG );
|
|
105 |
|
|
106 |
CTestCAknQueryDialog* testDlg = static_cast<CTestCAknQueryDialog*>( dlg );
|
|
107 |
|
|
108 |
CAknMultilineQueryControl* mQC = static_cast<CAknMultilineQueryControl*>( testDlg->QueryControl() );
|
|
109 |
|
|
110 |
CCoeControl* control = mQC->ControlByLayoutOrNull( EMultiDataSecondPhoneEd );
|
|
111 |
STIF_ASSERT_NULL( control );
|
|
112 |
|
|
113 |
control = mQC->ControlByLayoutOrNull( EMultiDataSecondSecEd );
|
|
114 |
STIF_ASSERT_NULL( control );
|
|
115 |
|
|
116 |
control = mQC->ControlByLayoutOrNull( EMultiDataSecondDateEd );
|
|
117 |
STIF_ASSERT_NULL( control );
|
|
118 |
|
|
119 |
control = mQC->ControlByLayoutOrNull( EMultiDataSecondTimeEd );
|
|
120 |
STIF_ASSERT_NULL( control );
|
|
121 |
|
|
122 |
control = mQC->ControlByLayoutOrNull( EMultiDataSecondDurEd );
|
|
123 |
STIF_ASSERT_NULL( control );
|
|
124 |
|
|
125 |
control = mQC->ControlByLayoutOrNull( EMultiDataSecondNumEd );
|
|
126 |
STIF_ASSERT_NULL( control );
|
|
127 |
|
|
128 |
control = mQC->ControlByLayoutOrNull( EMultiDataSecondPinEd );
|
|
129 |
STIF_ASSERT_NULL( control );
|
|
130 |
|
|
131 |
control = mQC->ControlByLayoutOrNull( EMultiDataSecondLocationEd );
|
|
132 |
STIF_ASSERT_NULL( control );
|
|
133 |
|
|
134 |
CleanupStack::PopAndDestroy( dlg );
|
|
135 |
return KErrNone;
|
|
136 |
}
|
|
137 |
|
|
138 |
// -----------------------------------------------------------------------------
|
|
139 |
// CTestSDKQueries::TestMqdlgNewL
|
|
140 |
// -----------------------------------------------------------------------------
|
|
141 |
//
|
|
142 |
TInt CTestSDKQueries::TestMlqcMinimumSizeL( CStifItemParser& /*aItem*/ )
|
|
143 |
{
|
|
144 |
CAknMultilineQueryControl* mQC = new( ELeave ) CAknMultilineQueryControl;
|
|
145 |
CleanupStack::PushL( mQC );
|
|
146 |
|
|
147 |
TSize returnSize = mQC->MinimumSize();
|
|
148 |
TSize compareSize( KZero, KZero );
|
|
149 |
STIF_ASSERT_NOT_EQUALS( compareSize, returnSize );
|
|
150 |
|
|
151 |
CleanupStack::PopAndDestroy( mQC );
|
|
152 |
return KErrNone;
|
|
153 |
}
|
|
154 |
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
// CTestSDKQueries::TestMqdlgNewL
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
TInt CTestSDKQueries::TestMlqcHandlePointerEventL( CStifItemParser& /*aItem*/ )
|
|
160 |
{
|
|
161 |
|
|
162 |
CAknMultilineQueryControl* mQc = new(ELeave) CAknMultilineQueryControl();
|
|
163 |
CleanupStack::PushL( mQc );
|
|
164 |
TResourceReader reader;
|
|
165 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_QUERY_DIALOG );
|
|
166 |
mQc->ConstructFromResourceL( reader );
|
|
167 |
|
|
168 |
TPointerEvent event;
|
|
169 |
event.iType = TPointerEvent::EButton1Down;
|
|
170 |
event.iModifiers = KZero;
|
|
171 |
TPoint eventPos( 10, 30 );
|
|
172 |
event.iPosition = eventPos;
|
|
173 |
event.iParentPosition = eventPos;
|
|
174 |
mQc->HandlePointerEventL( event );
|
|
175 |
|
|
176 |
CleanupStack::PopAndDestroy();
|
|
177 |
CleanupStack::PopAndDestroy( mQc );
|
|
178 |
return KErrNone;
|
|
179 |
}
|
|
180 |
|
|
181 |
// -----------------------------------------------------------------------------
|
|
182 |
// CTestSDKQueries::TestMqdlgNewL
|
|
183 |
// -----------------------------------------------------------------------------
|
|
184 |
//
|
|
185 |
TInt CTestSDKQueries::TestMlqcHandleResourceChangeL( CStifItemParser& /*aItem*/ )
|
|
186 |
{
|
|
187 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );
|
|
188 |
dlg->PrepareLC( R_QUERY_DIALOG );
|
|
189 |
|
|
190 |
CTestCAknQueryDialog* testDlg = static_cast<CTestCAknQueryDialog*>( dlg );
|
|
191 |
|
|
192 |
CAknMultilineQueryControl* mQC = static_cast<CAknMultilineQueryControl*>( testDlg->QueryControl() );
|
|
193 |
|
|
194 |
mQC->HandleResourceChange( KAknsMessageSkinChange );
|
|
195 |
mQC->HandleResourceChange( KEikDynamicLayoutVariantSwitch );
|
|
196 |
|
|
197 |
CleanupStack::PopAndDestroy( dlg );
|
|
198 |
return KErrNone;
|
|
199 |
}
|
|
200 |
|
|
201 |
// -----------------------------------------------------------------------------
|
|
202 |
// CTestSDKQueries::TestExtMlqcConstructorL
|
|
203 |
// -----------------------------------------------------------------------------
|
|
204 |
//
|
|
205 |
TInt CTestSDKQueries::TestExtMlqcConstructorL( CStifItemParser& /*aItem*/ )
|
|
206 |
{
|
|
207 |
CAknExtMultilineQueryControl* extMqc = new( ELeave ) CAknExtMultilineQueryControl;
|
|
208 |
CleanupStack::PushL( extMqc );
|
|
209 |
STIF_ASSERT_NOT_NULL( extMqc );
|
|
210 |
CleanupStack::PopAndDestroy( extMqc );
|
|
211 |
return KErrNone;
|
|
212 |
}
|
|
213 |
|
|
214 |
// -----------------------------------------------------------------------------
|
|
215 |
// CTestSDKQueries::TestExtMlqcDestructorL
|
|
216 |
// -----------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
TInt CTestSDKQueries::TestExtMlqcDestructorL( CStifItemParser& /*aItem*/ )
|
|
219 |
{
|
|
220 |
CAknExtMultilineQueryControl* extMqc = new( ELeave ) CAknExtMultilineQueryControl;
|
|
221 |
CleanupStack::PushL( extMqc );
|
|
222 |
CleanupStack::PopAndDestroy( extMqc );
|
|
223 |
return KErrNone;
|
|
224 |
}
|
|
225 |
|
|
226 |
// -----------------------------------------------------------------------------
|
|
227 |
// CTestSDKQueries::TestExtMlqcSetNbrOfPromptLinesL
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
TInt CTestSDKQueries::TestExtMlqcSetNbrOfPromptLinesL( CStifItemParser& /*aItem*/ )
|
|
231 |
{
|
|
232 |
CAknExtMultilineQueryControl* extMqc = new( ELeave ) CAknExtMultilineQueryControl;
|
|
233 |
CleanupStack::PushL( extMqc );
|
|
234 |
extMqc->SetNbrOfPromptLines( KOne, KTwo );
|
|
235 |
CleanupStack::PopAndDestroy( extMqc );
|
|
236 |
return KErrNone;
|
|
237 |
}
|
|
238 |
|
|
239 |
// -----------------------------------------------------------------------------
|
|
240 |
// CTestSDKQueries::TestExtMlqcIsFirstL
|
|
241 |
// -----------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
TInt CTestSDKQueries::TestExtMlqcIsFirstL( CStifItemParser& /*aItem*/ )
|
|
244 |
{
|
|
245 |
CAknExtMultilineQueryControl* extMqc = new( ELeave ) CAknExtMultilineQueryControl;
|
|
246 |
CleanupStack::PushL( extMqc );
|
|
247 |
TBool firstLine = extMqc->IsFirst();
|
|
248 |
STIF_ASSERT_TRUE( firstLine );
|
|
249 |
CleanupStack::PopAndDestroy( extMqc );
|
|
250 |
return KErrNone;
|
|
251 |
}
|
|
252 |
|
|
253 |
// -----------------------------------------------------------------------------
|
|
254 |
// CTestSDKQueries::TestExtMlqcIsSecondL
|
|
255 |
// -----------------------------------------------------------------------------
|
|
256 |
//
|
|
257 |
TInt CTestSDKQueries::TestExtMlqcIsSecondL( CStifItemParser& /*aItem*/ )
|
|
258 |
{
|
|
259 |
CAknExtMultilineQueryControl* extMqc = new( ELeave ) CAknExtMultilineQueryControl;
|
|
260 |
CleanupStack::PushL( extMqc );
|
|
261 |
TBool second = extMqc->IsSecond();
|
|
262 |
STIF_ASSERT_FALSE( second );
|
|
263 |
CleanupStack::PopAndDestroy( extMqc );
|
|
264 |
return KErrNone;
|
|
265 |
}
|
|
266 |
|
|
267 |
// -----------------------------------------------------------------------------
|
|
268 |
// CTestSDKQueries::TestExtMlqcControlByLayoutOrNullL
|
|
269 |
// -----------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
TInt CTestSDKQueries::TestExtMlqcControlByLayoutOrNullL( CStifItemParser& /*aItem*/ )
|
|
272 |
{
|
|
273 |
CAknExtMultilineQueryControl* extMqc = new( ELeave ) CAknExtMultilineQueryControl;
|
|
274 |
CleanupStack::PushL( extMqc );
|
|
275 |
|
|
276 |
CCoeControl* control = extMqc->ControlByLayoutOrNull( EMultiDataFirstIpEd );
|
|
277 |
STIF_ASSERT_NULL( control );
|
|
278 |
|
|
279 |
control = extMqc->ControlByLayoutOrNull( EMultiDataSecondIpEd );
|
|
280 |
STIF_ASSERT_NULL( control );
|
|
281 |
|
|
282 |
CleanupStack::PopAndDestroy( extMqc );
|
|
283 |
return KErrNone;
|
|
284 |
}
|
|
285 |
|
|
286 |
// -----------------------------------------------------------------------------
|
|
287 |
// CTestSDKQueries::TestExtMlqcMinimumSizeL
|
|
288 |
// -----------------------------------------------------------------------------
|
|
289 |
//
|
|
290 |
TInt CTestSDKQueries::TestExtMlqcMinimumSizeL( CStifItemParser& /*aItem*/ )
|
|
291 |
{
|
|
292 |
CAknExtMultilineQueryControl* extMqc = new( ELeave ) CAknExtMultilineQueryControl;
|
|
293 |
CleanupStack::PushL( extMqc );
|
|
294 |
|
|
295 |
TSize returnSize = extMqc->MinimumSize();
|
|
296 |
TSize compareSize( KZero, KZero );
|
|
297 |
STIF_ASSERT_NOT_EQUALS( compareSize, returnSize );
|
|
298 |
|
|
299 |
CleanupStack::PopAndDestroy( extMqc );
|
|
300 |
return KErrNone;
|
|
301 |
}
|
|
302 |
|
|
303 |
// -----------------------------------------------------------------------------
|
|
304 |
// CTestSDKQueries::TestExtMlqcHandlePointerEventL
|
|
305 |
// -----------------------------------------------------------------------------
|
|
306 |
//
|
|
307 |
TInt CTestSDKQueries::TestExtMlqcHandlePointerEventL( CStifItemParser& /*aItem*/ )
|
|
308 |
{
|
|
309 |
|
|
310 |
CAknExtMultilineQueryControl* extMqc = new(ELeave) CAknExtMultilineQueryControl();
|
|
311 |
CleanupStack::PushL( extMqc );
|
|
312 |
|
|
313 |
TResourceReader reader;
|
|
314 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_QUERY_DIALOG );
|
|
315 |
extMqc->ConstructFromResourceL( reader );
|
|
316 |
|
|
317 |
TPointerEvent event;
|
|
318 |
event.iType = TPointerEvent::EButton1Down;
|
|
319 |
event.iModifiers = KZero;
|
|
320 |
TPoint eventPos( 10, 30 );
|
|
321 |
event.iPosition = eventPos;
|
|
322 |
event.iParentPosition = eventPos;
|
|
323 |
extMqc->HandlePointerEventL( event );
|
|
324 |
|
|
325 |
CleanupStack::PopAndDestroy();
|
|
326 |
CleanupStack::PopAndDestroy( extMqc );
|
|
327 |
return KErrNone;
|
|
328 |
}
|
|
329 |
|
|
330 |
// -----------------------------------------------------------------------------
|
|
331 |
// CTestSDKQueries::TestExtMlqcHandleResourceChangeL
|
|
332 |
// -----------------------------------------------------------------------------
|
|
333 |
//
|
|
334 |
TInt CTestSDKQueries::TestExtMlqcHandleResourceChangeL( CStifItemParser& /*aItem*/ )
|
|
335 |
{
|
|
336 |
CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );
|
|
337 |
dlg->PrepareLC( R_QUERY_DIALOG );
|
|
338 |
|
|
339 |
CTestCAknQueryDialog* testDlg = static_cast<CTestCAknQueryDialog*>( dlg );
|
|
340 |
|
|
341 |
CAknExtMultilineQueryControl* extMqc = static_cast<CAknExtMultilineQueryControl*>( testDlg->QueryControl() );
|
|
342 |
|
|
343 |
extMqc->HandleResourceChange( KAknsMessageSkinChange );
|
|
344 |
extMqc->HandleResourceChange( KEikDynamicLayoutVariantSwitch );
|
|
345 |
|
|
346 |
CleanupStack::PopAndDestroy( dlg );
|
|
347 |
return KErrNone;
|
|
348 |
}
|
|
349 |
|
|
350 |
//End file
|
|
351 |
|
|
352 |
|
|
353 |
|