77
|
1 |
/*
|
|
2 |
* Copyright (c) 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: This file contains testclass implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// [INCLUDE FILES] - do not remove
|
|
19 |
#include <e32svr.h>
|
|
20 |
#include <StifParser.h>
|
|
21 |
#include <StifTestInterface.h>
|
|
22 |
#include "TSanimmif.h"
|
|
23 |
|
|
24 |
#include "sanimimageplugin.h"
|
|
25 |
|
|
26 |
#include "testwaiter.h"
|
|
27 |
|
|
28 |
#include <ecom/ecom.h>
|
|
29 |
|
|
30 |
#pragma tagging OFF // To disable CodeTest tagging
|
|
31 |
|
|
32 |
const TInt KSAnimMifPluginImplUid = 0x2000B11E;
|
|
33 |
|
|
34 |
_LIT( KUnknownFile, "C:\\temp\\unknown.mif" );
|
|
35 |
_LIT( KCorruptFile, "C:\\temp\\corrupt.mif" );
|
|
36 |
_LIT( KStillImageFile, "C:\\temp\\testimg_1.mif" );
|
|
37 |
_LIT( KScaledAnimationFile, "C:\\temp\\testanim_1.mif" );
|
|
38 |
_LIT( KUnscaledAnimationFile, "C:\\temp\\testanim_2.mif" );
|
|
39 |
_LIT( KStillImageNoMaskFile, "C:\\temp\\testimg_2.mif" );
|
|
40 |
_LIT( KNoFramesFile, "C:\\temp\\testimg_3.mif" );
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
45 |
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
// ?function_name ?description.
|
|
48 |
// ?description
|
|
49 |
// Returns: ?value_1: ?description
|
|
50 |
// ?value_n: ?description_line1
|
|
51 |
// ?description_line2
|
|
52 |
// -----------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
/*
|
|
55 |
?type ?function_name(
|
|
56 |
?arg_type arg, // ?description
|
|
57 |
?arg_type arg) // ?description
|
|
58 |
{
|
|
59 |
|
|
60 |
?code // ?comment
|
|
61 |
|
|
62 |
// ?comment
|
|
63 |
?code
|
|
64 |
}
|
|
65 |
*/
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
70 |
|
|
71 |
// -----------------------------------------------------------------------------
|
|
72 |
// CTSanimmif::Delete
|
|
73 |
// Delete here all resources allocated and opened from test methods.
|
|
74 |
// Called from destructor.
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
void CTSanimmif::Delete()
|
|
78 |
{
|
|
79 |
|
|
80 |
}
|
|
81 |
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
// CTSanimmif::RunMethodL
|
|
84 |
// Run specified method. Contains also table of test mothods and their names.
|
|
85 |
// -----------------------------------------------------------------------------
|
|
86 |
//
|
|
87 |
TInt CTSanimmif::RunMethodL(
|
|
88 |
CStifItemParser& aItem )
|
|
89 |
{
|
|
90 |
|
|
91 |
static TStifFunctionInfo const KFunctions[] =
|
|
92 |
{
|
|
93 |
// Copy this line for every implemented function.
|
|
94 |
// First string is the function name used in TestScripter script file.
|
|
95 |
// Second is the actual implementation member function.
|
|
96 |
ENTRY( "Example", CTSanimmif::ExampleL ),
|
|
97 |
ENTRY( "SetupEmpty", CTSanimmif::SetupEmptyL ),
|
|
98 |
ENTRY( "SetupObj", CTSanimmif::SetupObjL ),
|
|
99 |
ENTRY( "SetupFile", CTSanimmif::SetupFileL ),
|
|
100 |
ENTRY( "SetupStillImageNoMask", CTSanimmif::SetupStillImageNoMaskL ),
|
|
101 |
ENTRY( "SetupStillImage", CTSanimmif::SetupStillImageL ),
|
|
102 |
ENTRY( "SetupScaledAnimation", CTSanimmif::SetupScaledAnimationL ),
|
|
103 |
ENTRY( "SetupUnscaledAnimation", CTSanimmif::SetupUnscaledAnimationL ),
|
|
104 |
ENTRY( "SetupFinished", CTSanimmif::SetupFinishedL ),
|
|
105 |
ENTRY( "Teardown", CTSanimmif::Teardown ),
|
|
106 |
ENTRY( "TestConstructor", CTSanimmif::TestConstructorL ),
|
|
107 |
ENTRY( "TestConstructorNoMemory", CTSanimmif::TestConstructorNoMemoryL ),
|
|
108 |
ENTRY( "TestUnknownFile", CTSanimmif::TestUnknownFileL ),
|
|
109 |
ENTRY( "TestCorruptFile", CTSanimmif::TestCorruptFileL ),
|
|
110 |
ENTRY( "TestNoFramesFile", CTSanimmif::TestNoFramesFileL ),
|
|
111 |
ENTRY( "TestLoadStillImage", CTSanimmif::TestLoadStillImageL ),
|
|
112 |
ENTRY( "TestLoadScaledAnimation", CTSanimmif::TestLoadScaledAnimationL ),
|
|
113 |
ENTRY( "TestLoadUnscaledAnimation", CTSanimmif::TestLoadUnscaledAnimationL ),
|
|
114 |
ENTRY( "TestLoadNoMemory", CTSanimmif::TestLoadNoMemoryL ),
|
|
115 |
ENTRY( "TestCancelLoad", CTSanimmif::TestCancelLoadL ),
|
|
116 |
ENTRY( "TestShowStillImage", CTSanimmif::TestShowStillImageL ),
|
|
117 |
ENTRY( "TestShowAnimation", CTSanimmif::TestShowAnimationL ),
|
|
118 |
ENTRY( "TestCancelStillImage", CTSanimmif::TestCancelStillImageL ),
|
|
119 |
ENTRY( "TestCancelAnimation", CTSanimmif::TestCancelAnimationL ),
|
|
120 |
ENTRY( "TestCancelNotActive", CTSanimmif::TestCancelNotActiveL ),
|
|
121 |
ENTRY( "TestShowBeforeLoad", CTSanimmif::TestShowBeforeLoadL ),
|
|
122 |
ENTRY( "TestSetDisplayMode", CTSanimmif::TestSetDisplayModeL ),
|
|
123 |
ENTRY( "TestSetSize", CTSanimmif::TestSetSizeL ),
|
|
124 |
ENTRY( "TestSetFrameDelay", CTSanimmif::TestSetFrameDelayL ),
|
|
125 |
ENTRY( "TestBackroundColour", CTSanimmif::TestBackroundColourL ),
|
|
126 |
|
|
127 |
//ADD NEW ENTRY HERE
|
|
128 |
// [test cases entries] - Do not remove
|
|
129 |
|
|
130 |
};
|
|
131 |
|
|
132 |
const TInt count = sizeof( KFunctions ) /
|
|
133 |
sizeof( TStifFunctionInfo );
|
|
134 |
|
|
135 |
return RunInternalL( KFunctions, count, aItem );
|
|
136 |
|
|
137 |
}
|
|
138 |
|
|
139 |
// ======== MEMBER FUNCTIONS ========
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
// TMockMifAnimationObserver::UpdateScreen
|
|
143 |
//
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
void TMockMifAnimationObserver::UpdateScreen( const CFbsBitmap& /*aFrame*/, const CFbsBitmap& /*aMask*/ )
|
|
147 |
{
|
|
148 |
RDebug::Print( _L( "TMockMifAnimationObserver::UpdateScreen" ) );
|
|
149 |
|
|
150 |
iTestSuite.iFrameCounter++;
|
|
151 |
}
|
|
152 |
|
|
153 |
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
// TMockMifAnimationObserver::UpdateScreen
|
|
156 |
//
|
|
157 |
// ---------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
void TMockMifAnimationObserver::UpdateScreen( const CFbsBitmap& /*aFrame*/ )
|
|
160 |
{
|
|
161 |
iTestSuite.iFrameCounter++;
|
|
162 |
}
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
// CTSanimmif::SetupEmptyL
|
|
170 |
//
|
|
171 |
// ---------------------------------------------------------------------------
|
|
172 |
//
|
|
173 |
TInt CTSanimmif::SetupEmptyL()
|
|
174 |
{
|
|
175 |
iTestObj = NULL;
|
|
176 |
iDtorKey = TUid::Uid( 0 );
|
|
177 |
User::LeaveIfError( iFs.Connect() );
|
|
178 |
User::LeaveIfError( iFs.ShareProtected() );
|
|
179 |
iWaiter = CTestWaiter::NewL();
|
|
180 |
iFrameCounter = 0;
|
|
181 |
return KErrNone;
|
|
182 |
}
|
|
183 |
|
|
184 |
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
// CSAnimMifPluginTestSuite::SetupObjL
|
|
187 |
//
|
|
188 |
// ---------------------------------------------------------------------------
|
|
189 |
//
|
|
190 |
TInt CTSanimmif::SetupObjL()
|
|
191 |
{
|
|
192 |
SetupEmptyL();
|
|
193 |
iTestObj = static_cast<CSAnimImagePlugin*>(
|
|
194 |
REComSession::CreateImplementationL(
|
|
195 |
TUid::Uid( KSAnimMifPluginImplUid ), iDtorKey, &iObserver ) );
|
|
196 |
iTestObj->SetSize( TSize( 128, 128 ) );
|
|
197 |
return KErrNone;
|
|
198 |
}
|
|
199 |
|
|
200 |
|
|
201 |
// ---------------------------------------------------------------------------
|
|
202 |
// CSAnimMifPluginTestSuite::SetupFileL
|
|
203 |
//
|
|
204 |
// ---------------------------------------------------------------------------
|
|
205 |
//
|
|
206 |
TInt CTSanimmif::SetupFileL( const TDesC& aFileName )
|
|
207 |
{
|
|
208 |
SetupObjL();
|
|
209 |
iTestObj->Load( iFs, aFileName, iWaiter->iStatus );
|
|
210 |
iWaiter->Activate();
|
|
211 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
212 |
return KErrNone;
|
|
213 |
}
|
|
214 |
|
|
215 |
|
|
216 |
// ---------------------------------------------------------------------------
|
|
217 |
// CSAnimMifPluginTestSuite::SetupStillImageNoMaskL
|
|
218 |
//
|
|
219 |
// ---------------------------------------------------------------------------
|
|
220 |
//
|
|
221 |
TInt CTSanimmif::SetupStillImageNoMaskL()
|
|
222 |
{
|
|
223 |
SetupFileL( KStillImageNoMaskFile );
|
|
224 |
return KErrNone;
|
|
225 |
}
|
|
226 |
|
|
227 |
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
// CTSanimmif::SetupStillImageL
|
|
230 |
//
|
|
231 |
// ---------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
TInt CTSanimmif::SetupStillImageL()
|
|
234 |
{
|
|
235 |
SetupFileL( KStillImageFile );
|
|
236 |
return KErrNone;
|
|
237 |
}
|
|
238 |
|
|
239 |
|
|
240 |
// ---------------------------------------------------------------------------
|
|
241 |
// CTSanimmif::SetupScaledAnimationL
|
|
242 |
//
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
TInt CTSanimmif::SetupScaledAnimationL()
|
|
246 |
{
|
|
247 |
SetupFileL( KScaledAnimationFile );
|
|
248 |
return KErrNone;
|
|
249 |
}
|
|
250 |
|
|
251 |
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
// CTSanimmif::SetupUnscaledAnimationL
|
|
254 |
//
|
|
255 |
// ---------------------------------------------------------------------------
|
|
256 |
//
|
|
257 |
TInt CTSanimmif::SetupUnscaledAnimationL()
|
|
258 |
{
|
|
259 |
SetupFileL( KUnscaledAnimationFile );
|
|
260 |
return KErrNone;
|
|
261 |
}
|
|
262 |
|
|
263 |
|
|
264 |
// ---------------------------------------------------------------------------
|
|
265 |
// CTSanimmif::SetupFinishedL
|
|
266 |
//
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
TInt CTSanimmif::SetupFinishedL()
|
|
270 |
{
|
|
271 |
SetupUnscaledAnimationL();
|
|
272 |
iTestObj->Start( iWaiter->iStatus );
|
|
273 |
iWaiter->Activate();
|
|
274 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
275 |
return KErrNone;
|
|
276 |
}
|
|
277 |
|
|
278 |
|
|
279 |
// ---------------------------------------------------------------------------
|
|
280 |
// CTSanimmif::Teardown
|
|
281 |
//
|
|
282 |
// ---------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
TInt CTSanimmif::Teardown()
|
|
285 |
{
|
|
286 |
delete iTestObj;
|
|
287 |
iTestObj = NULL;
|
|
288 |
|
|
289 |
REComSession::DestroyedImplementation( iDtorKey );
|
|
290 |
|
|
291 |
delete iWaiter;
|
|
292 |
iWaiter = NULL;
|
|
293 |
|
|
294 |
iFs.Close();
|
|
295 |
|
|
296 |
REComSession::FinalClose();
|
|
297 |
return KErrNone;
|
|
298 |
}
|
|
299 |
|
|
300 |
|
|
301 |
// ---------------------------------------------------------------------------
|
|
302 |
// CSAnimMifPluginTestSuite::TestConstructorL
|
|
303 |
//
|
|
304 |
// ---------------------------------------------------------------------------
|
|
305 |
//
|
|
306 |
TInt CTSanimmif::TestConstructorL()
|
|
307 |
{
|
|
308 |
TAny* ptr = NULL;
|
|
309 |
ptr = REComSession::CreateImplementationL(TUid::Uid( KSAnimMifPluginImplUid ), iDtorKey, &iObserver );
|
|
310 |
|
|
311 |
iTestObj = static_cast<CSAnimImagePlugin*>( ptr );
|
|
312 |
// EUNIT_ASSERT( iTestObj );
|
|
313 |
delete iTestObj;
|
|
314 |
iTestObj = NULL;
|
|
315 |
return KErrNone;
|
|
316 |
}
|
|
317 |
|
|
318 |
|
|
319 |
// ---------------------------------------------------------------------------
|
|
320 |
// CSAnimMifPluginTestSuite::TestConstructorNoMemoryL
|
|
321 |
//
|
|
322 |
// ---------------------------------------------------------------------------
|
|
323 |
//
|
|
324 |
TInt CTSanimmif::TestConstructorNoMemoryL()
|
|
325 |
{
|
|
326 |
TAny* ptr = NULL;
|
|
327 |
ptr = REComSession::CreateImplementationL(TUid::Uid( KSAnimMifPluginImplUid ), iDtorKey, &iObserver );
|
|
328 |
// EUNIT_ASSERT( !ptr );
|
|
329 |
return KErrNone;
|
|
330 |
}
|
|
331 |
|
|
332 |
|
|
333 |
// ---------------------------------------------------------------------------
|
|
334 |
// CSAnimMifPluginTestSuite::TestUnknownFileL
|
|
335 |
//
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
//
|
|
338 |
TInt CTSanimmif::TestUnknownFileL()
|
|
339 |
{
|
|
340 |
iTestObj->Load( iFs, KUnknownFile, iWaiter->iStatus );
|
|
341 |
iWaiter->Activate();
|
|
342 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
343 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNotFound );
|
|
344 |
return KErrNone;
|
|
345 |
}
|
|
346 |
|
|
347 |
|
|
348 |
// ---------------------------------------------------------------------------
|
|
349 |
// CTSanimmif::TestCorruptFileL
|
|
350 |
//
|
|
351 |
// ---------------------------------------------------------------------------
|
|
352 |
//
|
|
353 |
TInt CTSanimmif::TestCorruptFileL()
|
|
354 |
{
|
|
355 |
iTestObj->Load( iFs, KCorruptFile, iWaiter->iStatus );
|
|
356 |
iWaiter->Activate();
|
|
357 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
358 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrCorrupt );
|
|
359 |
return KErrNone;
|
|
360 |
}
|
|
361 |
|
|
362 |
|
|
363 |
// ---------------------------------------------------------------------------
|
|
364 |
// CSAnimMifPluginTestSuite::TestNoFramesFileL
|
|
365 |
//
|
|
366 |
// ---------------------------------------------------------------------------
|
|
367 |
//
|
|
368 |
TInt CTSanimmif::TestNoFramesFileL()
|
|
369 |
{
|
|
370 |
iTestObj->Load( iFs, KNoFramesFile, iWaiter->iStatus );
|
|
371 |
iWaiter->Activate();
|
|
372 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
373 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrCorrupt );
|
|
374 |
return KErrNone;
|
|
375 |
}
|
|
376 |
|
|
377 |
|
|
378 |
// ---------------------------------------------------------------------------
|
|
379 |
// CSAnimMifPluginTestSuite::TestLoadStillImageL
|
|
380 |
//
|
|
381 |
// ---------------------------------------------------------------------------
|
|
382 |
//
|
|
383 |
TInt CTSanimmif::TestLoadStillImageL()
|
|
384 |
{
|
|
385 |
iTestObj->Load( iFs, KStillImageFile, iWaiter->iStatus );
|
|
386 |
iWaiter->Activate();
|
|
387 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
388 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
389 |
return KErrNone;
|
|
390 |
}
|
|
391 |
|
|
392 |
|
|
393 |
// ---------------------------------------------------------------------------
|
|
394 |
// CSAnimMifPluginTestSuite::TestLoadScaledAnimationL
|
|
395 |
//
|
|
396 |
// ---------------------------------------------------------------------------
|
|
397 |
//
|
|
398 |
TInt CTSanimmif::TestLoadScaledAnimationL()
|
|
399 |
{
|
|
400 |
iTestObj->Load( iFs, KScaledAnimationFile, iWaiter->iStatus );
|
|
401 |
iWaiter->Activate();
|
|
402 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
403 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
404 |
return KErrNone;
|
|
405 |
}
|
|
406 |
|
|
407 |
|
|
408 |
// ---------------------------------------------------------------------------
|
|
409 |
// CSAnimMifPluginTestSuite::TestLoadUnscaledAnimationL
|
|
410 |
//
|
|
411 |
// ---------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
TInt CTSanimmif::TestLoadUnscaledAnimationL()
|
|
414 |
{
|
|
415 |
iTestObj->Load( iFs, KUnscaledAnimationFile, iWaiter->iStatus );
|
|
416 |
iWaiter->Activate();
|
|
417 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
418 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
419 |
return KErrNone;
|
|
420 |
}
|
|
421 |
|
|
422 |
|
|
423 |
// ---------------------------------------------------------------------------
|
|
424 |
// CSAnimMifPluginTestSuite::TestLoadNoMemoryL
|
|
425 |
//
|
|
426 |
// ---------------------------------------------------------------------------
|
|
427 |
//
|
|
428 |
TInt CTSanimmif::TestLoadNoMemoryL()
|
|
429 |
{
|
|
430 |
iTestObj->Load( iFs, KUnscaledAnimationFile, iWaiter->iStatus );
|
|
431 |
iWaiter->Activate();
|
|
432 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
433 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNoMemory );
|
|
434 |
return KErrNone;
|
|
435 |
}
|
|
436 |
|
|
437 |
|
|
438 |
// ---------------------------------------------------------------------------
|
|
439 |
// CSAnimMifPluginTestSuite::TestCancelLoadL
|
|
440 |
//
|
|
441 |
// ---------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
TInt CTSanimmif::TestCancelLoadL()
|
|
444 |
{
|
|
445 |
iTestObj->Load( iFs, KUnscaledAnimationFile, iWaiter->iStatus );
|
|
446 |
iWaiter->Activate();
|
|
447 |
iTestObj->Cancel();
|
|
448 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
449 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone ); // Load is syncronous
|
|
450 |
return KErrNone;
|
|
451 |
}
|
|
452 |
|
|
453 |
|
|
454 |
// ---------------------------------------------------------------------------
|
|
455 |
// CSAnimMifPluginTestSuite::TestShowStillImageL
|
|
456 |
//
|
|
457 |
// ---------------------------------------------------------------------------
|
|
458 |
//
|
|
459 |
TInt CTSanimmif::TestShowStillImageL()
|
|
460 |
{
|
|
461 |
iTestObj->Start( iWaiter->iStatus );
|
|
462 |
iWaiter->Activate();
|
|
463 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
464 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
465 |
// EUNIT_ASSERT_EQUALS( iFrameCounter, 1 );
|
|
466 |
return KErrNone;
|
|
467 |
}
|
|
468 |
|
|
469 |
|
|
470 |
// ---------------------------------------------------------------------------
|
|
471 |
// CSAnimMifPluginTestSuite::TestShowAnimationL
|
|
472 |
//
|
|
473 |
// ---------------------------------------------------------------------------
|
|
474 |
//
|
|
475 |
TInt CTSanimmif::TestShowAnimationL()
|
|
476 |
{
|
|
477 |
iTestObj->Start( iWaiter->iStatus );
|
|
478 |
iWaiter->Activate();
|
|
479 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
480 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
481 |
// EUNIT_ASSERT( iFrameCounter > 1 );
|
|
482 |
return KErrNone;
|
|
483 |
}
|
|
484 |
|
|
485 |
|
|
486 |
// ---------------------------------------------------------------------------
|
|
487 |
// CSAnimMifPluginTestSuite::TestCancelStillImageL
|
|
488 |
//
|
|
489 |
// ---------------------------------------------------------------------------
|
|
490 |
//
|
|
491 |
TInt CTSanimmif::TestCancelStillImageL()
|
|
492 |
{
|
|
493 |
iTestObj->Start( iWaiter->iStatus );
|
|
494 |
iWaiter->Activate();
|
|
495 |
iTestObj->Cancel();
|
|
496 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
497 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrCancel );
|
|
498 |
return KErrNone;
|
|
499 |
}
|
|
500 |
|
|
501 |
|
|
502 |
// ---------------------------------------------------------------------------
|
|
503 |
// CTSanimmif::TestCancelAnimationL
|
|
504 |
//
|
|
505 |
// ---------------------------------------------------------------------------
|
|
506 |
//
|
|
507 |
TInt CTSanimmif::TestCancelAnimationL()
|
|
508 |
{
|
|
509 |
iTestObj->Start( iWaiter->iStatus );
|
|
510 |
iWaiter->Activate();
|
|
511 |
iTestObj->Cancel();
|
|
512 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
513 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrCancel );
|
|
514 |
return KErrNone;
|
|
515 |
}
|
|
516 |
|
|
517 |
|
|
518 |
// ---------------------------------------------------------------------------
|
|
519 |
// CTSanimmif::TestCancelNotActiveL
|
|
520 |
//
|
|
521 |
// ---------------------------------------------------------------------------
|
|
522 |
//
|
|
523 |
TInt CTSanimmif::TestCancelNotActiveL()
|
|
524 |
{
|
|
525 |
iTestObj->Cancel();
|
|
526 |
return KErrNone;
|
|
527 |
}
|
|
528 |
|
|
529 |
|
|
530 |
// ---------------------------------------------------------------------------
|
|
531 |
// CSAnimMifPluginTestSuite::TestShowBeforeLoadL
|
|
532 |
//
|
|
533 |
// ---------------------------------------------------------------------------
|
|
534 |
//
|
|
535 |
TInt CTSanimmif::TestShowBeforeLoadL()
|
|
536 |
{
|
|
537 |
//EUNIT_ASSERT_PANIC( iTestObj->Start( iWaiter->iStatus ), "STARTUPANIMATION", 2 );
|
|
538 |
return KErrNone;
|
|
539 |
}
|
|
540 |
|
|
541 |
|
|
542 |
// ---------------------------------------------------------------------------
|
|
543 |
// CTSanimmif::TestSetDisplayModeL
|
|
544 |
//
|
|
545 |
// ---------------------------------------------------------------------------
|
|
546 |
//
|
|
547 |
TInt CTSanimmif::TestSetDisplayModeL()
|
|
548 |
{
|
|
549 |
iTestObj->SetDisplayMode( EGray2 );
|
|
550 |
iTestObj->Load( iFs, KStillImageFile, iWaiter->iStatus );
|
|
551 |
iTestObj->SetDisplayMode( ENone );
|
|
552 |
iWaiter->Activate();
|
|
553 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
554 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
555 |
iTestObj->SetDisplayMode( EColor16MA );
|
|
556 |
iTestObj->SetDisplayMode( EColor16MU );
|
|
557 |
iTestObj->Start( iWaiter->iStatus );
|
|
558 |
iWaiter->Activate();
|
|
559 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
560 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
561 |
iTestObj->SetDisplayMode( EColor256 );
|
|
562 |
return KErrNone;
|
|
563 |
}
|
|
564 |
|
|
565 |
|
|
566 |
// ---------------------------------------------------------------------------
|
|
567 |
// CSAnimMifPluginTestSuite::TestSetSizeL
|
|
568 |
//
|
|
569 |
// ---------------------------------------------------------------------------
|
|
570 |
//
|
|
571 |
TInt CTSanimmif::TestSetSizeL()
|
|
572 |
{
|
|
573 |
iTestObj->SetSize( TSize( 10, 10 ) );
|
|
574 |
iTestObj->Load( iFs, KStillImageFile, iWaiter->iStatus );
|
|
575 |
iTestObj->SetSize( TSize( 10000, 10000 ) );
|
|
576 |
iWaiter->Activate();
|
|
577 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
578 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
579 |
iTestObj->SetSize( TSize( 0, 0 ) );
|
|
580 |
iTestObj->SetSize( TSize( 2, 1000 ) );
|
|
581 |
iTestObj->Start( iWaiter->iStatus );
|
|
582 |
iWaiter->Activate();
|
|
583 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
584 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
585 |
iTestObj->SetSize( TSize( 1, 1 ) );
|
|
586 |
return KErrNone;
|
|
587 |
}
|
|
588 |
|
|
589 |
|
|
590 |
// ---------------------------------------------------------------------------
|
|
591 |
// CSAnimMifPluginTestSuite::TestSetFrameDelayL
|
|
592 |
//
|
|
593 |
// ---------------------------------------------------------------------------
|
|
594 |
//
|
|
595 |
TInt CTSanimmif::TestSetFrameDelayL()
|
|
596 |
{
|
|
597 |
iTestObj->SetFrameDelay( 100 );
|
|
598 |
iTestObj->Load( iFs, KUnscaledAnimationFile, iWaiter->iStatus );
|
|
599 |
iTestObj->SetFrameDelay( 0 );
|
|
600 |
iWaiter->Activate();
|
|
601 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
602 |
// EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
603 |
iTestObj->SetFrameDelay( 12000 );
|
|
604 |
iTestObj->SetFrameDelay( 50 );
|
|
605 |
iTestObj->Start( iWaiter->iStatus );
|
|
606 |
iWaiter->Activate();
|
|
607 |
CActiveScheduler::Start(); // Waiter stops it when request completes.
|
|
608 |
//EUNIT_ASSERT_EQUALS( iWaiter->iStatus.Int(), KErrNone );
|
|
609 |
iTestObj->SetFrameDelay( 3 );
|
|
610 |
return KErrNone;
|
|
611 |
}
|
|
612 |
|
|
613 |
|
|
614 |
// ---------------------------------------------------------------------------
|
|
615 |
// CSAnimMifPluginTestSuite::TestBackroundColourL
|
|
616 |
//
|
|
617 |
// ---------------------------------------------------------------------------
|
|
618 |
//
|
|
619 |
TInt CTSanimmif::TestBackroundColourL()
|
|
620 |
{
|
|
621 |
TRgb colour = iTestObj->BackroundColour();
|
|
622 |
// EUNIT_ASSERT_EQUALS( colour, TRgb() ); // Empty
|
|
623 |
return KErrNone;
|
|
624 |
}
|
|
625 |
|
|
626 |
|
|
627 |
|
|
628 |
// -----------------------------------------------------------------------------
|
|
629 |
// CTSanimmif::ExampleL
|
|
630 |
// Example test method function.
|
|
631 |
// (other items were commented in a header).
|
|
632 |
// -----------------------------------------------------------------------------
|
|
633 |
//
|
|
634 |
TInt CTSanimmif::ExampleL( CStifItemParser& aItem )
|
|
635 |
{
|
|
636 |
|
|
637 |
// Print to UI
|
|
638 |
_LIT( KTSanimmif, "TSanimmif" );
|
|
639 |
_LIT( KExample, "In Example" );
|
|
640 |
TestModuleIf().Printf( 0, KTSanimmif, KExample );
|
|
641 |
// Print to log file
|
|
642 |
iLog->Log( KExample );
|
|
643 |
|
|
644 |
TInt i = 0;
|
|
645 |
TPtrC string;
|
|
646 |
_LIT( KParam, "Param[%i]: %S" );
|
|
647 |
while ( aItem.GetNextString ( string ) == KErrNone )
|
|
648 |
{
|
|
649 |
TestModuleIf().Printf( i, KTSanimmif,
|
|
650 |
KParam, i, &string );
|
|
651 |
i++;
|
|
652 |
}
|
|
653 |
|
|
654 |
return KErrNone;
|
|
655 |
|
|
656 |
}
|
|
657 |
|
|
658 |
|
|
659 |
// End of File
|