0
|
1 |
// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
#include <e32math.h>
|
|
17 |
#include "testvideoplayer2.h"
|
|
18 |
|
|
19 |
#ifdef SYMBIAN_BUILD_GCE
|
|
20 |
#include <graphics/surfacemanager.h>
|
|
21 |
#endif
|
|
22 |
|
|
23 |
const TInt KSettingsAndAlignmentTest = 3;
|
|
24 |
|
|
25 |
//
|
|
26 |
// RTestVclntPlayAviFile
|
|
27 |
//
|
|
28 |
|
|
29 |
/**
|
|
30 |
* RTestVclnt2PlayFile::Constructor
|
|
31 |
*/
|
|
32 |
RTestVclnt2PlayFile::RTestVclnt2PlayFile(const TDesC& aTestName,
|
|
33 |
const TDesC& aSectName,
|
|
34 |
const TDesC& aKeyName,
|
|
35 |
TInt aExpectedError)
|
|
36 |
: RTestVclnt2AviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
/**
|
|
41 |
* RTestVclnt2PlayFile::NewL
|
|
42 |
*/
|
|
43 |
RTestVclnt2PlayFile* RTestVclnt2PlayFile::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
|
44 |
{
|
|
45 |
RTestVclnt2PlayFile* self = new (ELeave) RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError);
|
|
46 |
return self;
|
|
47 |
}
|
|
48 |
|
|
49 |
/**
|
|
50 |
* RTestVclnt2PlayFile::DoTestStepPreambleL
|
|
51 |
*/
|
|
52 |
TVerdict RTestVclnt2PlayFile::DoTestStepPreambleL()
|
|
53 |
{
|
|
54 |
return RTestVclnt2AviPlayerStep::DoTestStepPreambleL();
|
|
55 |
}
|
|
56 |
|
|
57 |
/**
|
|
58 |
* RTestVclnt2PlayFile::DoTestStepPostambleL
|
|
59 |
*/
|
|
60 |
TVerdict RTestVclnt2PlayFile::DoTestStepPostambleL()
|
|
61 |
{
|
|
62 |
return RTestVclnt2AviPlayerStep::DoTestStepPostambleL();
|
|
63 |
}
|
|
64 |
|
|
65 |
/**
|
|
66 |
* RTestVclnt2PlayFile::FsmL
|
|
67 |
*/
|
|
68 |
void RTestVclnt2PlayFile::FsmL(TVclntTestPlayEvents aEventCode)
|
|
69 |
{
|
|
70 |
if (FsmCheck(aEventCode))
|
|
71 |
{
|
|
72 |
switch (aEventCode)
|
|
73 |
{
|
|
74 |
case EVPIdle:
|
|
75 |
HandleIdleL();
|
|
76 |
break;
|
|
77 |
|
|
78 |
case EVPOpenComplete:
|
|
79 |
HandleOpenCompleteL();
|
|
80 |
break;
|
|
81 |
|
|
82 |
case EVPPrepareComplete:
|
|
83 |
HandlePrepareCompleteL();
|
|
84 |
break;
|
|
85 |
|
|
86 |
case EVPPlayComplete:
|
|
87 |
HandlePlayCompleteL();
|
|
88 |
break;
|
|
89 |
}
|
|
90 |
}
|
|
91 |
}
|
|
92 |
|
|
93 |
void RTestVclnt2PlayFile::HandleIdleL()
|
|
94 |
{
|
|
95 |
// Open iVideoPlayer
|
|
96 |
INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
|
|
97 |
iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
|
|
98 |
PrepareState(EVPOpenComplete, KErrNone);
|
|
99 |
}
|
|
100 |
|
|
101 |
void RTestVclnt2PlayFile::HandleOpenCompleteL()
|
|
102 |
{
|
|
103 |
// Prepare iVideoPlayer2
|
|
104 |
INFO_PRINTF1(_L("iVideoPlayer2->Prepare()"));
|
|
105 |
iVideoPlayer2->Prepare();
|
|
106 |
PrepareState(EVPPrepareComplete, KErrNone);
|
|
107 |
}
|
|
108 |
|
|
109 |
void RTestVclnt2PlayFile::HandlePrepareCompleteL()
|
|
110 |
{
|
|
111 |
// Add display window using default values - ie. video extent & window clipping
|
|
112 |
// defaulted to whole window
|
|
113 |
INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
|
|
114 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
115 |
|
|
116 |
// trigger the video to start playing
|
|
117 |
StartPlayback();
|
|
118 |
}
|
|
119 |
|
|
120 |
void RTestVclnt2PlayFile::HandlePlayCompleteL()
|
|
121 |
{
|
|
122 |
iTestStepResult = EPass;
|
|
123 |
CActiveScheduler::Stop();
|
|
124 |
}
|
|
125 |
|
|
126 |
void RTestVclnt2PlayFile::StartPlayback()
|
|
127 |
{
|
|
128 |
iError = KErrTimedOut;
|
|
129 |
INFO_PRINTF1(_L("iVideoPlayer2->Play()"));
|
|
130 |
PrepareState(EVPPlayComplete, KErrNone);
|
|
131 |
iVideoPlayer2->Play();
|
|
132 |
}
|
|
133 |
|
|
134 |
#ifdef SYMBIAN_BUILD_GCE
|
|
135 |
//
|
|
136 |
// RTestMediaClientVideoDisplay
|
|
137 |
//
|
|
138 |
|
|
139 |
/**
|
|
140 |
* RTestMediaClientVideoDisplay::Constructor
|
|
141 |
*/
|
|
142 |
|
|
143 |
|
|
144 |
RTestMediaClientVideoDisplay::RTestMediaClientVideoDisplay(const TDesC& aTestName,
|
|
145 |
const TDesC& aSectName,
|
|
146 |
const TDesC& aKeyName,
|
|
147 |
TInt aExpectedError)
|
|
148 |
: RTestVclnt2AviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
|
|
149 |
{
|
|
150 |
}
|
|
151 |
|
|
152 |
/**
|
|
153 |
* RTestMediaClientVideoDisplay::NewL
|
|
154 |
*/
|
|
155 |
|
|
156 |
RTestMediaClientVideoDisplay* RTestMediaClientVideoDisplay::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
|
157 |
{
|
|
158 |
RTestMediaClientVideoDisplay* self = new (ELeave) RTestMediaClientVideoDisplay(aTestName, aSectName, aKeyName, aExpectedError);
|
|
159 |
return self;
|
|
160 |
}
|
|
161 |
|
|
162 |
/**
|
|
163 |
* RTestMediaClientVideoDisplay::DoTestStepPreambleL
|
|
164 |
*/
|
|
165 |
|
|
166 |
TVerdict RTestMediaClientVideoDisplay::DoTestStepPreambleL()
|
|
167 |
{
|
|
168 |
return RTestVclnt2AviPlayerStep::DoTestStepPreambleL();
|
|
169 |
}
|
|
170 |
|
|
171 |
/**
|
|
172 |
* RTestMediaClientVideoDisplay::DoTestStepPostambleL
|
|
173 |
*/
|
|
174 |
|
|
175 |
TVerdict RTestMediaClientVideoDisplay::DoTestStepPostambleL()
|
|
176 |
{
|
|
177 |
return RTestVclnt2AviPlayerStep::DoTestStepPostambleL();
|
|
178 |
}
|
|
179 |
|
|
180 |
/**
|
|
181 |
* RTestMediaClientVideoDisplay::FsmL
|
|
182 |
*/
|
|
183 |
void RTestMediaClientVideoDisplay::FsmL(TVclntTestPlayEvents aEventCode)
|
|
184 |
{
|
|
185 |
if (FsmCheck(aEventCode))
|
|
186 |
{
|
|
187 |
switch (aEventCode)
|
|
188 |
{
|
|
189 |
case EVPIdle:
|
|
190 |
HandleIdleL();
|
|
191 |
break;
|
|
192 |
|
|
193 |
case EVPOpenComplete:
|
|
194 |
HandleOpenCompleteL();
|
|
195 |
break;
|
|
196 |
|
|
197 |
case EVPPrepareComplete:
|
|
198 |
HandlePrepareCompleteL();
|
|
199 |
break;
|
|
200 |
|
|
201 |
case EVPPlayComplete:
|
|
202 |
HandlePlayCompleteL();
|
|
203 |
break;
|
|
204 |
}
|
|
205 |
}
|
|
206 |
}
|
|
207 |
|
|
208 |
void RTestMediaClientVideoDisplay::HandleIdleL()
|
|
209 |
{
|
|
210 |
// Open iVideoPlayer
|
|
211 |
INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
|
|
212 |
iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
|
|
213 |
PrepareState(EVPOpenComplete, KErrNone);
|
|
214 |
}
|
|
215 |
|
|
216 |
void RTestMediaClientVideoDisplay::HandleOpenCompleteL()
|
|
217 |
{
|
|
218 |
// Prepare iVideoPlayer2
|
|
219 |
INFO_PRINTF1(_L("iVideoPlayer2->Prepare()"));
|
|
220 |
iVideoPlayer2->Prepare();
|
|
221 |
PrepareState(EVPPrepareComplete, KErrNone);
|
|
222 |
}
|
|
223 |
|
|
224 |
void RTestMediaClientVideoDisplay::HandlePrepareCompleteL()
|
|
225 |
{
|
|
226 |
// trigger the video to start playing
|
|
227 |
StartPlayback();
|
|
228 |
|
|
229 |
TInt displayId = iScreen->GetScreenNumber();
|
|
230 |
TRect clipRect = TRect(iWindow->Size());
|
|
231 |
TRect cropRegion = clipRect;
|
|
232 |
|
|
233 |
// ==========================
|
|
234 |
|
|
235 |
iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
|
|
236 |
|
|
237 |
RSurfaceManager surfaceManager;
|
|
238 |
User::LeaveIfError(surfaceManager.Open());
|
|
239 |
|
|
240 |
RSurfaceManager::TSurfaceCreationAttributesBuf bf;
|
|
241 |
RSurfaceManager::TSurfaceCreationAttributes& b=bf();
|
|
242 |
b.iSize.iWidth = 320;
|
|
243 |
b.iSize.iHeight = 240;
|
|
244 |
b.iBuffers = 1;
|
|
245 |
b.iPixelFormat = EUidPixelFormatXRGB_8888;
|
|
246 |
b.iStride = 320 * 4;
|
|
247 |
b.iOffsetToFirstBuffer = 0;
|
|
248 |
b.iAlignment=4;
|
|
249 |
b.iContiguous=ETrue;
|
|
250 |
|
|
251 |
TRect cropRect(0, 0, 320, 240);
|
|
252 |
TVideoAspectRatio par(1,2);
|
|
253 |
TSurfaceId surfaceId;
|
|
254 |
|
|
255 |
User::LeaveIfError(surfaceManager.CreateSurface(bf, surfaceId));
|
|
256 |
|
|
257 |
iMediaClientVideoDisplay->SurfaceCreated(surfaceId, cropRect, par, cropRegion);
|
|
258 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SurfaceCreated()"));
|
|
259 |
|
|
260 |
delete iMediaClientVideoDisplay;
|
|
261 |
iMediaClientVideoDisplay = NULL;
|
|
262 |
|
|
263 |
// ==================
|
|
264 |
|
|
265 |
iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId);
|
|
266 |
|
|
267 |
TRect videoExtent = clipRect;
|
|
268 |
TReal32 scaleWidth(100.0f);
|
|
269 |
TReal32 scaleHeight(100.0f);
|
|
270 |
TInt horizPos(EHorizontalAlignCenter);
|
|
271 |
TInt vertPos(EVerticalAlignCenter);
|
|
272 |
|
|
273 |
TReal32 widthPercentage(50.0f);
|
|
274 |
TReal32 heightPercentage(50.0f);
|
|
275 |
TReal32 widthP;
|
|
276 |
TReal32 heightP;
|
|
277 |
RWindow newWindow;
|
|
278 |
|
|
279 |
// Check for invalid rotation when adding new window
|
|
280 |
INFO_PRINTF1(_L("Testing invalid rotations for AddDisplayWindowL"));
|
|
281 |
TInt err = KErrNone;
|
|
282 |
TVideoRotation rotation = static_cast<TVideoRotation>(-1);
|
|
283 |
TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow));
|
|
284 |
if (err != KErrArgument)
|
|
285 |
{
|
|
286 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative rotation"));
|
|
287 |
iTestStepResult = EFail;
|
|
288 |
CActiveScheduler::Stop();
|
|
289 |
return;
|
|
290 |
}
|
|
291 |
|
|
292 |
rotation = static_cast<TVideoRotation>(4);
|
|
293 |
TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow));
|
|
294 |
if (err != KErrArgument)
|
|
295 |
{
|
|
296 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range rotation"));
|
|
297 |
iTestStepResult = EFail;
|
|
298 |
CActiveScheduler::Stop();
|
|
299 |
return;
|
|
300 |
}
|
|
301 |
|
|
302 |
rotation = EVideoRotationNone;
|
|
303 |
|
|
304 |
// Check for invalid autoScaleType when adding new window
|
|
305 |
INFO_PRINTF1(_L("Testing invalid autoScaleType for AddDisplayWindowL"));
|
|
306 |
TAutoScaleType autoScaleType = static_cast<TAutoScaleType>(-1);
|
|
307 |
TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, autoScaleType, horizPos, vertPos, iWindow));
|
|
308 |
if (err != KErrArgument)
|
|
309 |
{
|
|
310 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for negative scale"));
|
|
311 |
iTestStepResult = EFail;
|
|
312 |
CActiveScheduler::Stop();
|
|
313 |
return;
|
|
314 |
}
|
|
315 |
|
|
316 |
autoScaleType = static_cast<TAutoScaleType>(4);
|
|
317 |
TRAP(err, iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, autoScaleType, horizPos, vertPos, iWindow));
|
|
318 |
if (err != KErrArgument)
|
|
319 |
{
|
|
320 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() did not leave with KErrArgument for out of range scale"));
|
|
321 |
iTestStepResult = EFail;
|
|
322 |
CActiveScheduler::Stop();
|
|
323 |
return;
|
|
324 |
}
|
|
325 |
|
|
326 |
iMediaClientVideoDisplay->AddDisplayWindowL(iWindow, clipRect, cropRegion, videoExtent, scaleWidth, scaleHeight, rotation, EAutoScaleBestFit, horizPos, vertPos, iWindow);
|
|
327 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->AddDisplayWindowL()"));
|
|
328 |
|
|
329 |
// Check for invalid rotation when setting rotation for window
|
|
330 |
INFO_PRINTF1(_L("Testing invalid rotation for SetRotationL"));
|
|
331 |
TVideoRotation videoRotation = static_cast<TVideoRotation>(-1);
|
|
332 |
TRAP(err, iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion));
|
|
333 |
if (err != KErrArgument)
|
|
334 |
{
|
|
335 |
ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for negative value"));
|
|
336 |
iTestStepResult = EFail;
|
|
337 |
CActiveScheduler::Stop();
|
|
338 |
return;
|
|
339 |
}
|
|
340 |
|
|
341 |
videoRotation = static_cast<TVideoRotation>(4);
|
|
342 |
TRAP(err, iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion));
|
|
343 |
if (err != KErrArgument)
|
|
344 |
{
|
|
345 |
ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL(window) did not leave with KErrArgument for out of range value"));
|
|
346 |
iTestStepResult = EFail;
|
|
347 |
CActiveScheduler::Stop();
|
|
348 |
return;
|
|
349 |
}
|
|
350 |
|
|
351 |
// Check for invalid rotation when setting rotation for all windows
|
|
352 |
videoRotation = static_cast<TVideoRotation>(-1);
|
|
353 |
TRAP(err, iMediaClientVideoDisplay->SetRotationL(videoRotation, cropRegion));
|
|
354 |
if (err != KErrArgument)
|
|
355 |
{
|
|
356 |
ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for negative value"));
|
|
357 |
iTestStepResult = EFail;
|
|
358 |
CActiveScheduler::Stop();
|
|
359 |
return;
|
|
360 |
}
|
|
361 |
|
|
362 |
videoRotation = static_cast<TVideoRotation>(4);
|
|
363 |
TRAP(err, iMediaClientVideoDisplay->SetRotationL(videoRotation, cropRegion));
|
|
364 |
if (err != KErrArgument)
|
|
365 |
{
|
|
366 |
ERR_PRINTF1(_L("iVideoPlayer2->SetRotationL() did not leave with KErrArgument for out of range value"));
|
|
367 |
iTestStepResult = EFail;
|
|
368 |
CActiveScheduler::Stop();
|
|
369 |
return;
|
|
370 |
}
|
|
371 |
|
|
372 |
videoRotation = EVideoRotationClockwise180;
|
|
373 |
|
|
374 |
iMediaClientVideoDisplay->SetRotationL(*iWindow, videoRotation, cropRegion);
|
|
375 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
|
|
376 |
|
|
377 |
if (iMediaClientVideoDisplay->RotationL(*iWindow) != videoRotation)
|
|
378 |
{
|
|
379 |
ERR_PRINTF1(_L("iMediaClientVideoDisplay->RotationL() returns an unexpected value. Test aborted."));
|
|
380 |
|
|
381 |
iTestStepResult = EInconclusive;
|
|
382 |
CActiveScheduler::Stop();
|
|
383 |
}
|
|
384 |
else
|
|
385 |
{
|
|
386 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->RotationL()"));
|
|
387 |
}
|
|
388 |
|
|
389 |
iMediaClientVideoDisplay->SetScaleFactorL(*iWindow, widthPercentage, heightPercentage, cropRegion);
|
|
390 |
iMediaClientVideoDisplay->SetScaleFactorL(widthPercentage, heightPercentage, cropRegion);
|
|
391 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetScaleFactorL()"));
|
|
392 |
|
|
393 |
iMediaClientVideoDisplay->SetRotationL(EVideoRotationClockwise90, cropRegion);
|
|
394 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetRotationL()"));
|
|
395 |
|
|
396 |
iMediaClientVideoDisplay->GetScaleFactorL(*iWindow, widthP, heightP);
|
|
397 |
INFO_PRINTF3(_L("iMediaClientVideoDisplay->GetScaleFactorL() %df %df"), &widthP, &heightP);
|
|
398 |
|
|
399 |
iMediaClientVideoDisplay->SetVideoExtentL(*iWindow, videoExtent, cropRegion);
|
|
400 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetVideoExtentL()"));
|
|
401 |
|
|
402 |
iMediaClientVideoDisplay->SetWindowClipRectL(*iWindow, clipRect, cropRegion);
|
|
403 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetWindowClipRectL()"));
|
|
404 |
|
|
405 |
// Check for invalid autoScaleType when setting autoScaleType for window
|
|
406 |
INFO_PRINTF1(_L("Testing invalid autoScaleType for SetAutoScaleL"));
|
|
407 |
autoScaleType = static_cast<TAutoScaleType>(-1);
|
|
408 |
TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(*iWindow, autoScaleType, horizPos, vertPos, cropRegion));
|
|
409 |
if (err != KErrArgument)
|
|
410 |
{
|
|
411 |
ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for negative value"));
|
|
412 |
iTestStepResult = EFail;
|
|
413 |
CActiveScheduler::Stop();
|
|
414 |
return;
|
|
415 |
}
|
|
416 |
|
|
417 |
autoScaleType = static_cast<TAutoScaleType>(4);
|
|
418 |
TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(*iWindow, autoScaleType, horizPos, vertPos, cropRegion));
|
|
419 |
if (err != KErrArgument)
|
|
420 |
{
|
|
421 |
ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL(window) did not leave with KErrArgument for out of range value"));
|
|
422 |
iTestStepResult = EFail;
|
|
423 |
CActiveScheduler::Stop();
|
|
424 |
return;
|
|
425 |
}
|
|
426 |
|
|
427 |
// Check for invalid autoScaleType when setting autoScaleType for all windows
|
|
428 |
autoScaleType = static_cast<TAutoScaleType>(-1);
|
|
429 |
TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(autoScaleType, horizPos, vertPos, cropRegion));
|
|
430 |
if (err != KErrArgument)
|
|
431 |
{
|
|
432 |
ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for negative value"));
|
|
433 |
iTestStepResult = EFail;
|
|
434 |
CActiveScheduler::Stop();
|
|
435 |
return;
|
|
436 |
}
|
|
437 |
|
|
438 |
autoScaleType = static_cast<TAutoScaleType>(4);
|
|
439 |
TRAP(err, iMediaClientVideoDisplay->SetAutoScaleL(autoScaleType, horizPos, vertPos, cropRegion));
|
|
440 |
if (err != KErrArgument)
|
|
441 |
{
|
|
442 |
ERR_PRINTF1(_L("iVideoPlayer2->SetAutoScaleL() did not leave with KErrArgument for out of range value"));
|
|
443 |
iTestStepResult = EFail;
|
|
444 |
CActiveScheduler::Stop();
|
|
445 |
return;
|
|
446 |
}
|
|
447 |
|
|
448 |
iMediaClientVideoDisplay->SetAutoScaleL(EAutoScaleBestFit, horizPos, vertPos, cropRegion);
|
|
449 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SetAutoScaleL()"));
|
|
450 |
|
|
451 |
iMediaClientVideoDisplay->RedrawWindows(cropRegion);
|
|
452 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->RedrawWindows()"));
|
|
453 |
|
|
454 |
iMediaClientVideoDisplay->SurfaceParametersChanged(surfaceId, cropRect, par);
|
|
455 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->SurfaceParametersChanged()"));
|
|
456 |
|
|
457 |
iMediaClientVideoDisplay->RemoveSurface();
|
|
458 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->ReplaceSurface()"));
|
|
459 |
|
|
460 |
iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
|
|
461 |
INFO_PRINTF1(_L("iMediaClientVideoDisplay->RemoveDisplayWindow()"));
|
|
462 |
|
4
|
463 |
iMediaClientVideoDisplay->SetExternalDisplaySwitchingL(ETrue);
|
|
464 |
iMediaClientVideoDisplay->SetExternalDisplaySwitchingL(EFalse);
|
|
465 |
iMediaClientVideoDisplay->SetExternalDisplaySwitchingL(EFalse);
|
|
466 |
iMediaClientVideoDisplay->SetExternalDisplaySwitchingL(ETrue);
|
|
467 |
|
|
468 |
// create media class with other NewL.
|
|
469 |
delete iMediaClientVideoDisplay;
|
|
470 |
iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(displayId, surfaceId, cropRect, par);
|
|
471 |
|
0
|
472 |
surfaceManager.CloseSurface(surfaceId);
|
|
473 |
surfaceId = TSurfaceId::CreateNullId();
|
|
474 |
surfaceManager.Close();
|
|
475 |
|
|
476 |
delete iMediaClientVideoDisplay;
|
|
477 |
iMediaClientVideoDisplay = NULL;
|
|
478 |
}
|
|
479 |
|
|
480 |
void RTestMediaClientVideoDisplay::HandlePlayCompleteL()
|
|
481 |
{
|
|
482 |
iTestStepResult = EPass;
|
|
483 |
CActiveScheduler::Stop();
|
|
484 |
}
|
|
485 |
|
|
486 |
void RTestMediaClientVideoDisplay::StartPlayback()
|
|
487 |
{
|
|
488 |
iError = KErrTimedOut;
|
|
489 |
INFO_PRINTF1(_L("iVideoPlayer2->Play()"));
|
|
490 |
PrepareState(EVPPlayComplete, KErrNone);
|
|
491 |
iVideoPlayer2->Play();
|
|
492 |
}
|
|
493 |
|
|
494 |
#endif
|
|
495 |
|
|
496 |
//
|
|
497 |
// RTestVclnt2PerformActionDuringVideoPlayback
|
|
498 |
//
|
|
499 |
|
|
500 |
/**
|
|
501 |
* RTestVclnt2PerformActionDuringVideoPlayback::Constructor
|
|
502 |
*/
|
|
503 |
RTestVclnt2PerformActionDuringVideoPlayback::RTestVclnt2PerformActionDuringVideoPlayback(
|
|
504 |
const TDesC& aTestName,
|
|
505 |
const TDesC& aSectName,
|
|
506 |
const TDesC& aKeyName,
|
|
507 |
TInt aExpectedError)
|
|
508 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
509 |
{
|
|
510 |
}
|
|
511 |
|
|
512 |
/**
|
|
513 |
* RTestVclnt2PerformActionDuringVideoPlayback::HandlePlayCompleteL
|
|
514 |
*/
|
|
515 |
void RTestVclnt2PerformActionDuringVideoPlayback::HandlePlayCompleteL()
|
|
516 |
{
|
|
517 |
if (iActionError != KErrNone)
|
|
518 |
{
|
|
519 |
ERR_PRINTF2(_L("Playback event left with error %d."), iActionError);
|
|
520 |
iTestStepResult = EFail;
|
|
521 |
}
|
|
522 |
else
|
|
523 |
{
|
|
524 |
iTestStepResult = EPass;
|
|
525 |
}
|
|
526 |
|
|
527 |
CActiveScheduler::Stop();
|
|
528 |
}
|
|
529 |
|
|
530 |
/**
|
|
531 |
* RTestVclnt2PerformActionDuringVideoPlayback::StartPlayback
|
|
532 |
*/
|
|
533 |
void RTestVclnt2PerformActionDuringVideoPlayback::StartPlayback()
|
|
534 |
{
|
|
535 |
RTestVclnt2PlayFile::StartPlayback();
|
|
536 |
|
|
537 |
iActionError = KErrNone;
|
|
538 |
TRAP(iActionError, DoThisActionDuringPlaybackL(*iVideoPlayer2));
|
|
539 |
}
|
|
540 |
|
|
541 |
|
|
542 |
//
|
|
543 |
// RTestVclnt2AddWin
|
|
544 |
//
|
|
545 |
/**
|
|
546 |
* RTestVclnt2AddWin::Constructor
|
|
547 |
*/
|
|
548 |
RTestVclnt2AddWin::RTestVclnt2AddWin(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
549 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
550 |
{
|
|
551 |
}
|
|
552 |
|
|
553 |
/**
|
|
554 |
* RTestVclnt2AddWin::NewL
|
|
555 |
*/
|
|
556 |
RTestVclnt2AddWin* RTestVclnt2AddWin::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
557 |
{
|
|
558 |
RTestVclnt2AddWin* self = new (ELeave) RTestVclnt2AddWin(aTestName, aSectName, aKeyName, aExpectedError);
|
|
559 |
return self;
|
|
560 |
}
|
|
561 |
|
|
562 |
/**
|
|
563 |
* RTestVclnt2AddWin::HandlePrepareCompleteL
|
|
564 |
*/
|
|
565 |
void RTestVclnt2AddWin::HandlePrepareCompleteL()
|
|
566 |
{
|
|
567 |
// retrieve video size
|
|
568 |
TSize videoSize;
|
|
569 |
iVideoPlayer2->VideoFrameSizeL(videoSize);
|
|
570 |
|
|
571 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0505")) == 0)
|
|
572 |
{
|
|
573 |
// create a clipping rect partially out of screen
|
|
574 |
TRect windowRect(iWindow->Size());
|
|
575 |
windowRect.SetWidth(windowRect.Width() * 2);
|
|
576 |
|
|
577 |
// Add the display window with a partially out of screen clipping rect
|
|
578 |
TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs,
|
|
579 |
*iScreen,
|
|
580 |
*iWindow,
|
|
581 |
TRect(iWindow->Size()),
|
|
582 |
windowRect));
|
|
583 |
if (err != iTestExpectedError)
|
|
584 |
{
|
|
585 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
|
|
586 |
|
|
587 |
iTestStepResult = EFail;
|
|
588 |
CActiveScheduler::Stop();
|
|
589 |
|
|
590 |
return;
|
|
591 |
}
|
|
592 |
|
|
593 |
// create a clipping rect completely out of screen
|
|
594 |
windowRect.SetRect(TPoint(0, 0), iWindow->Size());
|
|
595 |
windowRect.Move(windowRect.Width() + 10, 0);
|
|
596 |
|
|
597 |
// Add the display window with a completely out of screen clipping rect
|
|
598 |
TRAP(err, iVideoPlayer2->AddDisplayWindowL(iWs,
|
|
599 |
*iScreen,
|
|
600 |
*iWindow,
|
|
601 |
TRect(iWindow->Size()),
|
|
602 |
windowRect));
|
|
603 |
if (err != iTestExpectedError)
|
|
604 |
{
|
|
605 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
|
|
606 |
|
|
607 |
iTestStepResult = EFail;
|
|
608 |
CActiveScheduler::Stop();
|
|
609 |
|
|
610 |
return;
|
|
611 |
}
|
|
612 |
else
|
|
613 |
{
|
|
614 |
// Reset the expected error to KErrNone as all expected failure tests have been completed.
|
|
615 |
// Any error that appears after this should fail the test
|
|
616 |
iTestExpectedError = KErrNone;
|
|
617 |
}
|
|
618 |
|
|
619 |
// after failing to add window display with a partially & a completely out of screen
|
|
620 |
// clipping rect, proceed to add a valid clipping rect below
|
|
621 |
}
|
|
622 |
|
|
623 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0401")) == 0 ||
|
|
624 |
iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0505")) == 0)
|
|
625 |
{
|
|
626 |
// shrink both the video & window size by half
|
|
627 |
TRect videoRect(videoSize);
|
|
628 |
videoRect.SetHeight(videoSize.iHeight / 2);
|
|
629 |
videoRect.SetWidth(videoSize.iWidth / 2);
|
|
630 |
|
|
631 |
TRect windowRect(iWindow->Size());
|
|
632 |
windowRect.SetHeight(iWindow->Size().iHeight / 2);
|
|
633 |
windowRect.SetWidth(iWindow->Size().iWidth / 2);
|
|
634 |
|
|
635 |
// ensure the rect is within the boundary of the window
|
|
636 |
TRect finalRect(windowRect);
|
|
637 |
finalRect.Intersection(videoRect);
|
|
638 |
|
|
639 |
// add display window using this valid clipping rect
|
|
640 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, finalRect, finalRect);
|
|
641 |
}
|
|
642 |
else
|
|
643 |
{
|
|
644 |
// Invalid test case
|
|
645 |
User::Panic(_L("RTestVclnt2AddWin"), KErrArgument);
|
|
646 |
}
|
|
647 |
|
|
648 |
// Start video playback
|
|
649 |
StartPlayback();
|
|
650 |
}
|
|
651 |
|
|
652 |
|
|
653 |
//
|
|
654 |
// RTestVclnt2RemoveWin
|
|
655 |
//
|
|
656 |
|
|
657 |
/**
|
|
658 |
* RTestVclnt2RemoveWin::Constructor
|
|
659 |
*/
|
|
660 |
RTestVclnt2RemoveWin::RTestVclnt2RemoveWin(const TDesC& aTestName,
|
|
661 |
const TDesC& aSectName,
|
|
662 |
const TDesC& aKeyName,
|
|
663 |
TInt aExpectedError,
|
|
664 |
TBool aAddBack)
|
|
665 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError),
|
|
666 |
iAddBack(aAddBack)
|
|
667 |
{
|
|
668 |
}
|
|
669 |
|
|
670 |
/**
|
|
671 |
* RTestVclnt2RemoveWin::NewL
|
|
672 |
*/
|
|
673 |
RTestVclnt2RemoveWin* RTestVclnt2RemoveWin::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aAddBack)
|
|
674 |
{
|
|
675 |
RTestVclnt2RemoveWin* self = new (ELeave) RTestVclnt2RemoveWin(aTestName, aSectName, aKeyName, aExpectedError, aAddBack);
|
|
676 |
return self;
|
|
677 |
}
|
|
678 |
|
|
679 |
/**
|
|
680 |
* RTestVclnt2RemoveWin::HandlePrepareCompleteL
|
|
681 |
*/
|
|
682 |
void RTestVclnt2RemoveWin::HandlePrepareCompleteL()
|
|
683 |
{
|
|
684 |
// retrieve video size
|
|
685 |
TSize videoSize;
|
|
686 |
iVideoPlayer2->VideoFrameSizeL(videoSize);
|
|
687 |
|
|
688 |
// shrink both the video & window size by half
|
|
689 |
TRect videoRect(videoSize);
|
|
690 |
videoRect.SetHeight(videoSize.iHeight / 2);
|
|
691 |
videoRect.SetWidth(videoSize.iWidth / 2);
|
|
692 |
|
|
693 |
TRect windowRect(iWindow->Size());
|
|
694 |
windowRect.SetHeight(iWindow->Size().iHeight / 2);
|
|
695 |
windowRect.SetWidth(iWindow->Size().iWidth / 2);
|
|
696 |
|
|
697 |
// ensure the rect is within the boundary of the window
|
|
698 |
TRect finalRect(windowRect);
|
|
699 |
finalRect.Intersection(videoRect);
|
|
700 |
|
|
701 |
// add display window using this valid clipping rect
|
|
702 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, finalRect, finalRect);
|
|
703 |
|
|
704 |
// trigger the video to start playing
|
|
705 |
StartPlayback();
|
|
706 |
}
|
|
707 |
|
|
708 |
/**
|
|
709 |
* RTestVclnt2RemoveWin::DoThisActionDuringPlaybackL
|
|
710 |
*/
|
|
711 |
void RTestVclnt2RemoveWin::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
|
|
712 |
{
|
|
713 |
// Play the video clip using a specific display window & video clipping setting
|
|
714 |
// first
|
|
715 |
TTimeIntervalMicroSeconds duration = aPlayer.DurationL();
|
|
716 |
|
|
717 |
// After a quarter of the clip's duration
|
|
718 |
User::After(duration.Int64() / 4);
|
|
719 |
|
|
720 |
// remove the original display
|
|
721 |
aPlayer.RemoveDisplayWindow(*iWindow);
|
|
722 |
|
|
723 |
|
|
724 |
if (iAddBack)
|
|
725 |
{
|
|
726 |
// Add the window using default values to continues
|
|
727 |
aPlayer.AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
728 |
}
|
|
729 |
}
|
|
730 |
|
|
731 |
|
|
732 |
//
|
|
733 |
// RTestVclnt2WinPos
|
|
734 |
//
|
|
735 |
|
|
736 |
/**
|
|
737 |
* RTestVclnt2WinPos::Constructor
|
|
738 |
*/
|
|
739 |
RTestVclnt2WinPos::RTestVclnt2WinPos(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
740 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
741 |
{
|
|
742 |
}
|
|
743 |
|
|
744 |
/**
|
|
745 |
* RTestVclnt2WinPos::NewL
|
|
746 |
*/
|
|
747 |
RTestVclnt2WinPos* RTestVclnt2WinPos::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
748 |
{
|
|
749 |
RTestVclnt2WinPos* self = new (ELeave) RTestVclnt2WinPos(aTestName, aSectName, aKeyName, aExpectedError);
|
|
750 |
return self;
|
|
751 |
}
|
|
752 |
|
|
753 |
/**
|
|
754 |
* RTestVclnt2WinPos::DoThisActionDuringPlaybackL
|
|
755 |
*/
|
|
756 |
void RTestVclnt2WinPos::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
|
|
757 |
{
|
|
758 |
TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
|
|
759 |
|
|
760 |
// shrink the window clipping rect by half the height & width
|
|
761 |
aPlayer.SetWindowClipRectL(*iWindow, TRect(windowSize));
|
|
762 |
}
|
|
763 |
|
|
764 |
|
|
765 |
//
|
|
766 |
// RTestVclnt2VideoExt
|
|
767 |
//
|
|
768 |
|
|
769 |
/**
|
|
770 |
* RTestVclnt2VideoExt::Constructor
|
|
771 |
*/
|
|
772 |
RTestVclnt2VideoExt::RTestVclnt2VideoExt(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
773 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
774 |
{
|
|
775 |
}
|
|
776 |
|
|
777 |
/**
|
|
778 |
* RTestVclnt2VideoExt::NewL
|
|
779 |
*/
|
|
780 |
RTestVclnt2VideoExt* RTestVclnt2VideoExt::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
781 |
{
|
|
782 |
RTestVclnt2VideoExt* self = new (ELeave) RTestVclnt2VideoExt(aTestName, aSectName, aKeyName, aExpectedError);
|
|
783 |
return self;
|
|
784 |
}
|
|
785 |
|
|
786 |
/**
|
|
787 |
* RTestVclnt2VideoExt::DoThisActionDuringPlaybackL
|
|
788 |
*/
|
|
789 |
void RTestVclnt2VideoExt::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
|
|
790 |
{
|
|
791 |
TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
|
|
792 |
|
|
793 |
// shrink the video extent by half the height & width
|
|
794 |
aPlayer.SetVideoExtentL(*iWindow, TRect(windowSize));
|
|
795 |
}
|
|
796 |
|
|
797 |
|
|
798 |
//
|
|
799 |
// RTestVclnt2ClipRect
|
|
800 |
//
|
|
801 |
|
|
802 |
/**
|
|
803 |
* RTestVclnt2ClipRect::Constructor
|
|
804 |
*/
|
|
805 |
RTestVclnt2ClipRect::RTestVclnt2ClipRect(const TDesC& aTestName,
|
|
806 |
const TDesC& aSectName,
|
|
807 |
const TDesC& aKeyName,
|
|
808 |
TInt aExpectedError)
|
|
809 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
810 |
{
|
|
811 |
}
|
|
812 |
|
|
813 |
/**
|
|
814 |
* RTestVclnt2ClipRect::NewL
|
|
815 |
*/
|
|
816 |
RTestVclnt2ClipRect* RTestVclnt2ClipRect::NewL(const TDesC& aTestName,
|
|
817 |
const TDesC& aSectName,
|
|
818 |
const TDesC& aKeyName,
|
|
819 |
TInt aExpectedError)
|
|
820 |
{
|
|
821 |
RTestVclnt2ClipRect* self
|
|
822 |
= new (ELeave) RTestVclnt2ClipRect(aTestName, aSectName, aKeyName, aExpectedError);
|
|
823 |
return self;
|
|
824 |
}
|
|
825 |
|
|
826 |
/**
|
|
827 |
* RTestVclnt2ClipRect::DoThisActionDuringPlaybackL
|
|
828 |
*/
|
|
829 |
void RTestVclnt2ClipRect::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
|
|
830 |
{
|
|
831 |
TRect clipRect;
|
|
832 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0405")) == 0)
|
|
833 |
{
|
|
834 |
// shrink the current window clipping rect by half the height & width
|
|
835 |
clipRect.Resize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
|
|
836 |
}
|
|
837 |
else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0503")) == 0)
|
|
838 |
{
|
|
839 |
// grow the current window clipping rect by double the width
|
|
840 |
clipRect.Resize(iWindow->Size().iWidth * 2, iWindow->Size().iHeight);
|
|
841 |
}
|
|
842 |
else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0504")) == 0)
|
|
843 |
{
|
|
844 |
// move the current window clipping rect to be out of the window
|
|
845 |
clipRect.SetSize(iWindow->Size());
|
|
846 |
clipRect.Move(TPoint(iWindow->Size().iWidth + 1, 0));
|
|
847 |
}
|
|
848 |
else
|
|
849 |
{
|
|
850 |
User::Panic(_L("RTestVclnt2ClipRect"), KErrArgument);
|
|
851 |
}
|
|
852 |
|
|
853 |
// change the window clipping of the display window
|
|
854 |
TRAPD(err, aPlayer.SetWindowClipRectL(*iWindow, clipRect));
|
|
855 |
if (err != iTestExpectedError)
|
|
856 |
{
|
|
857 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0503")) == 0 ||
|
|
858 |
iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0504")) == 0)
|
|
859 |
{
|
|
860 |
// for negative tests, stop the test if the failure is not expected
|
|
861 |
ERR_PRINTF1(_L("iVideoPlayer2->SetWindowClipRectL() did not failed as expected. Test failed."));
|
|
862 |
|
|
863 |
iTestStepResult = EInconclusive;
|
|
864 |
CActiveScheduler::Stop();
|
|
865 |
|
|
866 |
return;
|
|
867 |
}
|
|
868 |
else
|
|
869 |
{
|
|
870 |
// fail only if error is returned for positive tests
|
|
871 |
User::LeaveIfError(err);
|
|
872 |
}
|
|
873 |
}
|
|
874 |
else
|
|
875 |
{
|
|
876 |
// Reset the expected error to KErrNone as all expected failure tests have been completed.
|
|
877 |
// Any error that appears after this should fail the test
|
|
878 |
iTestExpectedError = KErrNone;
|
|
879 |
}
|
|
880 |
}
|
|
881 |
|
|
882 |
//
|
|
883 |
// RTestVclnt2Scale
|
|
884 |
//
|
|
885 |
|
|
886 |
/**
|
|
887 |
* RTestVclnt2Scale::Constructor
|
|
888 |
*/
|
|
889 |
RTestVclnt2Scale::RTestVclnt2Scale(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
890 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
891 |
{
|
|
892 |
}
|
|
893 |
|
|
894 |
/**
|
|
895 |
* RTestVclnt2Scale::NewL
|
|
896 |
*/
|
|
897 |
RTestVclnt2Scale* RTestVclnt2Scale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
898 |
{
|
|
899 |
RTestVclnt2Scale* self = new (ELeave) RTestVclnt2Scale(aTestName, aSectName, aKeyName, aExpectedError);
|
|
900 |
return self;
|
|
901 |
}
|
|
902 |
|
|
903 |
/**
|
|
904 |
* RTestVclnt2Scale::DoThisActionDuringPlaybackL
|
|
905 |
*/
|
|
906 |
void RTestVclnt2Scale::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
|
|
907 |
{
|
|
908 |
// Change the scale factor during playback
|
|
909 |
aPlayer.SetScaleFactorL(*iWindow, 150, 150);
|
|
910 |
}
|
|
911 |
|
|
912 |
/**
|
|
913 |
* RTestVclnt2Scale::HandlePrepareCompleteL
|
|
914 |
*/
|
|
915 |
void RTestVclnt2Scale::HandlePrepareCompleteL()
|
|
916 |
{
|
|
917 |
// Continue to setup the video utility and then trigger playback
|
|
918 |
RTestVclnt2PerformActionDuringVideoPlayback::HandlePrepareCompleteL();
|
|
919 |
|
|
920 |
TReal32 scaleFactor = 50.0;
|
|
921 |
|
|
922 |
// set scale factor to less than 100%
|
|
923 |
iVideoPlayer2->SetScaleFactorL(*iWindow, scaleFactor, scaleFactor);
|
|
924 |
|
|
925 |
// get scale factor
|
|
926 |
TReal32 widthScale;
|
|
927 |
TReal32 heightScale;
|
|
928 |
iVideoPlayer2->GetScaleFactorL(*iWindow, widthScale, heightScale);
|
|
929 |
|
|
930 |
if (widthScale != scaleFactor || heightScale != scaleFactor)
|
|
931 |
{
|
|
932 |
ERR_PRINTF1(_L("iVideoPlayer2->GetScaleFactorL() returns unexpected values. Test aborted."));
|
|
933 |
|
|
934 |
iTestStepResult = EInconclusive;
|
|
935 |
CActiveScheduler::Stop();
|
|
936 |
|
|
937 |
return;
|
|
938 |
}
|
|
939 |
}
|
|
940 |
|
|
941 |
|
|
942 |
//
|
|
943 |
// RTestVclnt2Viewport
|
|
944 |
//
|
|
945 |
|
|
946 |
/**
|
|
947 |
* RTestVclnt2Viewport::Constructor
|
|
948 |
*/
|
|
949 |
RTestVclnt2Viewport::RTestVclnt2Viewport(const TDesC& aTestName,
|
|
950 |
const TDesC& aSectName,
|
|
951 |
const TDesC& aKeyName,
|
|
952 |
const TSize& aViewportSize,
|
|
953 |
TInt aExpectedError)
|
|
954 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError),
|
|
955 |
iViewportSize(aViewportSize)
|
|
956 |
{
|
|
957 |
}
|
|
958 |
|
|
959 |
/**
|
|
960 |
* RTestVclnt2Viewport::NewL
|
|
961 |
*/
|
|
962 |
RTestVclnt2Viewport* RTestVclnt2Viewport::NewL(const TDesC& aTestName,
|
|
963 |
const TDesC& aSectName,
|
|
964 |
const TDesC& aKeyName,
|
|
965 |
const TSize& aViewportSize,
|
|
966 |
TInt aExpectedError)
|
|
967 |
{
|
|
968 |
RTestVclnt2Viewport* self = new (ELeave) RTestVclnt2Viewport(aTestName,
|
|
969 |
aSectName,
|
|
970 |
aKeyName,
|
|
971 |
aViewportSize,
|
|
972 |
aExpectedError);
|
|
973 |
return self;
|
|
974 |
}
|
|
975 |
|
|
976 |
void RTestVclnt2Viewport::HandlePrepareCompleteL()
|
|
977 |
{
|
|
978 |
// retrive original video size
|
|
979 |
TSize videoSize;
|
|
980 |
iVideoPlayer2->VideoFrameSizeL(videoSize);
|
|
981 |
|
|
982 |
// crop the top left quarter of the video
|
|
983 |
TRect cropRegion;
|
|
984 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
|
|
985 |
{
|
|
986 |
// Crop the right half of the video
|
|
987 |
cropRegion.SetHeight(videoSize.iHeight);
|
|
988 |
cropRegion.SetWidth(videoSize.iWidth / 2);
|
|
989 |
cropRegion.Move(cropRegion.Width(), 0);
|
|
990 |
}
|
|
991 |
else
|
|
992 |
{
|
|
993 |
cropRegion.SetWidth(iViewportSize.iWidth == -1 ? videoSize.iWidth : iViewportSize.iWidth);
|
|
994 |
cropRegion.SetHeight(iViewportSize.iHeight == -1 ? videoSize.iHeight : iViewportSize.iHeight);
|
|
995 |
}
|
|
996 |
|
|
997 |
TRect videoExtentRect;
|
|
998 |
TRect clipRegion;
|
|
999 |
|
|
1000 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
|
|
1001 |
{
|
|
1002 |
videoExtentRect.SetRect(TPoint(0, 0), videoSize);
|
|
1003 |
clipRegion.SetRect(TPoint(0, 0), videoSize);
|
|
1004 |
clipRegion.SetWidth(clipRegion.Width() / 2);
|
|
1005 |
clipRegion.Move(clipRegion.Width(), 0);
|
|
1006 |
}
|
|
1007 |
else
|
|
1008 |
{
|
|
1009 |
// Calculate the video extent to be exactly the same size as the cropped video picture,
|
|
1010 |
// placed at the center of the window
|
|
1011 |
TInt offsetX = (iWindow->Size().iWidth - cropRegion.Width()) / 2;
|
|
1012 |
TInt offsetY = (iWindow->Size().iHeight - cropRegion.Height()) / 2;
|
|
1013 |
videoExtentRect.SetRect(TPoint(offsetX, offsetY), cropRegion.Size());
|
|
1014 |
|
|
1015 |
// Set the window clipping region to the top vertical half of the cropped image, originating
|
|
1016 |
// from the top left corner of the window
|
|
1017 |
clipRegion = videoExtentRect;
|
|
1018 |
clipRegion.SetHeight(videoExtentRect.Height() / 2);
|
|
1019 |
}
|
|
1020 |
|
|
1021 |
HandlePrepareCompleteL(cropRegion, videoExtentRect, clipRegion);
|
|
1022 |
|
|
1023 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0508")) == 0)
|
|
1024 |
{
|
|
1025 |
// Align the image to the left of the window
|
|
1026 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, 0);
|
|
1027 |
}
|
|
1028 |
// trigger the video to start playing
|
|
1029 |
StartPlayback();
|
|
1030 |
}
|
|
1031 |
|
|
1032 |
void RTestVclnt2Viewport::HandlePrepareCompleteL(const TRect& aCropRegion,
|
|
1033 |
const TRect& aVideoExtent,
|
|
1034 |
const TRect& aClipRect)
|
|
1035 |
{
|
|
1036 |
iVideoPlayer2->SetCropRegionL(aCropRegion);
|
|
1037 |
|
|
1038 |
// get the video crop region to ensure the crop region is set
|
|
1039 |
TRect currentCropRegion;
|
|
1040 |
iVideoPlayer2->GetCropRegionL(currentCropRegion);
|
|
1041 |
|
|
1042 |
if (currentCropRegion != aCropRegion)
|
|
1043 |
{
|
|
1044 |
ERR_PRINTF1(_L("iVideoPlayer2->GetCropRegionL() returns an unexpected value. Test aborted."));
|
|
1045 |
|
|
1046 |
iTestStepResult = EInconclusive;
|
|
1047 |
CActiveScheduler::Stop();
|
|
1048 |
}
|
|
1049 |
|
|
1050 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, aVideoExtent, aClipRect);
|
|
1051 |
}
|
|
1052 |
|
|
1053 |
//
|
|
1054 |
// RTestVclnt2InvalidViewport
|
|
1055 |
//
|
|
1056 |
|
|
1057 |
/**
|
|
1058 |
* RTestVclnt2InvalidViewport::Constructor
|
|
1059 |
*/
|
|
1060 |
RTestVclnt2InvalidViewport::RTestVclnt2InvalidViewport(const TDesC& aTestName,
|
|
1061 |
const TDesC& aSectName,
|
|
1062 |
const TDesC& aKeyName,
|
|
1063 |
TInt aExpectedError)
|
|
1064 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1065 |
{
|
|
1066 |
}
|
|
1067 |
|
|
1068 |
/**
|
|
1069 |
* RTestVclnt2InvalidViewport::NewL
|
|
1070 |
*/
|
|
1071 |
RTestVclnt2InvalidViewport* RTestVclnt2InvalidViewport::NewL(const TDesC& aTestName,
|
|
1072 |
const TDesC& aSectName,
|
|
1073 |
const TDesC& aKeyName,
|
|
1074 |
TInt aExpectedError)
|
|
1075 |
{
|
|
1076 |
RTestVclnt2InvalidViewport* self = new (ELeave) RTestVclnt2InvalidViewport(aTestName,
|
|
1077 |
aSectName,
|
|
1078 |
aKeyName,
|
|
1079 |
aExpectedError);
|
|
1080 |
return self;
|
|
1081 |
}
|
|
1082 |
|
|
1083 |
/**
|
|
1084 |
* RTestVclnt2InvalidViewport::HandlePrepareCompleteL
|
|
1085 |
*/
|
|
1086 |
void RTestVclnt2InvalidViewport::HandlePrepareCompleteL()
|
|
1087 |
{
|
|
1088 |
// retrive original video size
|
|
1089 |
TSize videoSize;
|
|
1090 |
iVideoPlayer2->VideoFrameSizeL(videoSize);
|
|
1091 |
|
|
1092 |
// set the crop region to be completely out of the video image bound
|
|
1093 |
TRect cropRegion;
|
|
1094 |
cropRegion.SetRect(TPoint(videoSize.iWidth, videoSize.iHeight), TSize(100, 100));
|
|
1095 |
|
|
1096 |
// continue playback even if this fails
|
|
1097 |
TRAPD(err, iVideoPlayer2->SetCropRegionL(cropRegion));
|
|
1098 |
if (err == iTestExpectedError)
|
|
1099 |
{
|
|
1100 |
// the invalid crop area is not supposed to be set
|
|
1101 |
INFO_PRINTF1(_L("iVideoPlayer2->SetCropRegionL() returned expected. Test continues."));
|
|
1102 |
|
|
1103 |
// reset the expected error. Any error that appears after this should fail the test
|
|
1104 |
iTestExpectedError = KErrNone;
|
|
1105 |
}
|
|
1106 |
else
|
|
1107 |
{
|
|
1108 |
// the invalid crop area is not supposed to be set
|
|
1109 |
ERR_PRINTF1(_L("iVideoPlayer2->SetCropRegionL() didn't leave with expected error. Test cannot be continued."));
|
|
1110 |
|
|
1111 |
iTestStepResult = EInconclusive;
|
|
1112 |
CActiveScheduler::Stop();
|
|
1113 |
return;
|
|
1114 |
}
|
|
1115 |
|
|
1116 |
// get the video crop region to ensure the crop region is set
|
|
1117 |
TRect currentCropRegion;
|
|
1118 |
iVideoPlayer2->GetCropRegionL(currentCropRegion);
|
|
1119 |
|
|
1120 |
if (currentCropRegion != cropRegion)
|
|
1121 |
{
|
|
1122 |
// the invalid crop area is not supposed to be set
|
|
1123 |
ERR_PRINTF1(_L("iVideoPlayer2->GetCropRegionL() returns an unexpected value. Test cannot be continued."));
|
|
1124 |
|
|
1125 |
iTestStepResult = EInconclusive;
|
|
1126 |
CActiveScheduler::Stop();
|
|
1127 |
return;
|
|
1128 |
}
|
|
1129 |
|
|
1130 |
// setup the display then trigger the video to start playing
|
|
1131 |
RTestVclnt2PlayFile::HandlePrepareCompleteL();
|
|
1132 |
}
|
|
1133 |
|
|
1134 |
|
|
1135 |
//
|
|
1136 |
// RTestVclnt2Rotation
|
|
1137 |
//
|
|
1138 |
/**
|
|
1139 |
* RTestVclnt2Rotation::Constructor
|
|
1140 |
*/
|
|
1141 |
RTestVclnt2Rotation::RTestVclnt2Rotation(const TDesC& aTestName,
|
|
1142 |
const TDesC& aSectName,
|
|
1143 |
const TDesC& aKeyName,
|
|
1144 |
TInt aExpectedError)
|
|
1145 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1146 |
{
|
|
1147 |
}
|
|
1148 |
|
|
1149 |
/**
|
|
1150 |
* RTestVclnt2Rotation::NewL
|
|
1151 |
*/
|
|
1152 |
RTestVclnt2Rotation* RTestVclnt2Rotation::NewL(const TDesC& aTestName,
|
|
1153 |
const TDesC& aSectName,
|
|
1154 |
const TDesC& aKeyName,
|
|
1155 |
TInt aExpectedError)
|
|
1156 |
{
|
|
1157 |
RTestVclnt2Rotation* self = new (ELeave) RTestVclnt2Rotation(aTestName,
|
|
1158 |
aSectName,
|
|
1159 |
aKeyName,
|
|
1160 |
aExpectedError);
|
|
1161 |
return self;
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
/**
|
|
1165 |
* RTestVclnt2Rotation::HandlePrepareCompleteL
|
|
1166 |
*/
|
|
1167 |
void RTestVclnt2Rotation::HandlePrepareCompleteL()
|
|
1168 |
{
|
|
1169 |
// call parent's HandlePrepareCompleteL to finish off all preparation
|
|
1170 |
RTestVclnt2PlayFile::HandlePrepareCompleteL();
|
|
1171 |
|
|
1172 |
// set the video to be displayed upside-down
|
|
1173 |
TVideoRotation videoRotation(EVideoRotationClockwise180);
|
|
1174 |
iVideoPlayer2->SetRotationL(*iWindow, videoRotation);
|
|
1175 |
|
|
1176 |
// retrieve the rotation setting, and check if it's been properly updated
|
|
1177 |
if (iVideoPlayer2->RotationL(*iWindow) != videoRotation)
|
|
1178 |
{
|
|
1179 |
ERR_PRINTF1(_L("iVideoPlayer2->RotationL() returns an unexpected value. Test aborted."));
|
|
1180 |
|
|
1181 |
iTestStepResult = EInconclusive;
|
|
1182 |
CActiveScheduler::Stop();
|
|
1183 |
|
|
1184 |
return;
|
|
1185 |
}
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
//
|
|
1189 |
// RTestVclnt2Settings
|
|
1190 |
//
|
|
1191 |
/**
|
|
1192 |
* RTestVclnt2Settings::Constructor
|
|
1193 |
*/
|
|
1194 |
RTestVclnt2Settings::RTestVclnt2Settings(const TDesC& aTestName,
|
|
1195 |
const TDesC& aSectName,
|
|
1196 |
const TDesC& aKeyName,
|
|
1197 |
TInt aExpectedError)
|
|
1198 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1199 |
{
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
/**
|
|
1203 |
* RTestVclnt2Settings::NewL
|
|
1204 |
*/
|
|
1205 |
RTestVclnt2Settings* RTestVclnt2Settings::NewL(const TDesC& aTestName,
|
|
1206 |
const TDesC& aSectName,
|
|
1207 |
const TDesC& aKeyName,
|
|
1208 |
TInt aExpectedError)
|
|
1209 |
{
|
|
1210 |
RTestVclnt2Settings* self = new (ELeave) RTestVclnt2Settings(aTestName, aSectName, aKeyName, aExpectedError);
|
|
1211 |
return self;
|
|
1212 |
}
|
|
1213 |
|
|
1214 |
/**
|
|
1215 |
* RTestVclnt2Settings::HandlePrepareCompleteL
|
|
1216 |
*/
|
|
1217 |
void RTestVclnt2Settings::HandlePrepareCompleteL()
|
|
1218 |
{
|
|
1219 |
// retrieve the current frame size
|
|
1220 |
TSize frameSize;
|
|
1221 |
iVideoPlayer2->VideoFrameSizeL(frameSize);
|
|
1222 |
|
|
1223 |
TRect cropRegion(frameSize);
|
|
1224 |
// shrink the crop region to half its original height
|
|
1225 |
cropRegion.SetHeight(cropRegion.Height() / 2);
|
|
1226 |
iVideoPlayer2->SetCropRegionL(cropRegion);
|
|
1227 |
|
|
1228 |
TRect videoExtentRect;
|
|
1229 |
videoExtentRect.SetWidth(cropRegion.Width());
|
|
1230 |
videoExtentRect.SetHeight(cropRegion.Height());
|
|
1231 |
|
|
1232 |
videoExtentRect.Move((iWindow->Size().iWidth - videoExtentRect.Width()) / 2,
|
|
1233 |
(iWindow->Size().iHeight - videoExtentRect.Height()) / 2);
|
|
1234 |
|
|
1235 |
TRect clippingRect(videoExtentRect);
|
|
1236 |
clippingRect.SetWidth(clippingRect.Height() / 2);
|
|
1237 |
|
|
1238 |
// add display window using this valid clipping rect
|
|
1239 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtentRect, clippingRect);
|
|
1240 |
|
|
1241 |
// Scale the movie with best fit scaling, and vertically center the picture
|
|
1242 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleBestFit);
|
|
1243 |
|
|
1244 |
// Start video playback
|
|
1245 |
StartPlayback();
|
|
1246 |
}
|
|
1247 |
|
|
1248 |
|
|
1249 |
|
|
1250 |
//
|
|
1251 |
// RTestVclnt2SettingsAndAlignments
|
|
1252 |
//
|
|
1253 |
/**
|
|
1254 |
* RTestVclnt2SettingsAndAlignments::Constructor
|
|
1255 |
*/
|
|
1256 |
RTestVclnt2SettingsAndAlignments::RTestVclnt2SettingsAndAlignments(const TDesC& aTestName,
|
|
1257 |
const TDesC& aSectName,
|
|
1258 |
const TDesC& aKeyName,
|
|
1259 |
TInt aExpectedError)
|
|
1260 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1261 |
{
|
|
1262 |
}
|
|
1263 |
|
|
1264 |
/**
|
|
1265 |
* RTestVclnt2SettingsAndAlignments::NewL
|
|
1266 |
*/
|
|
1267 |
RTestVclnt2SettingsAndAlignments* RTestVclnt2SettingsAndAlignments::NewL(const TDesC& aTestName,
|
|
1268 |
const TDesC& aSectName,
|
|
1269 |
const TDesC& aKeyName,
|
|
1270 |
TInt aExpectedError)
|
|
1271 |
{
|
|
1272 |
RTestVclnt2SettingsAndAlignments* self = new (ELeave) RTestVclnt2SettingsAndAlignments(aTestName, aSectName, aKeyName, aExpectedError);
|
|
1273 |
return self;
|
|
1274 |
}
|
|
1275 |
|
|
1276 |
TVerdict RTestVclnt2SettingsAndAlignments::DoTestStepPreambleL()
|
|
1277 |
{
|
|
1278 |
iCount = 0;
|
|
1279 |
return RTestVclnt2PlayFile::DoTestStepPreambleL();
|
|
1280 |
}
|
|
1281 |
|
|
1282 |
/**
|
|
1283 |
* RTestVclnt2SettingsAndAlignments::HandlePrepareCompleteL
|
|
1284 |
*/
|
|
1285 |
void RTestVclnt2SettingsAndAlignments::HandlePrepareCompleteL()
|
|
1286 |
{
|
|
1287 |
TRect cropRegion;
|
|
1288 |
SetCropRegionL(cropRegion);
|
|
1289 |
|
|
1290 |
AddDisplayWindowL(cropRegion);
|
|
1291 |
|
|
1292 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0418")) == 0)
|
|
1293 |
{
|
|
1294 |
SetContentOffsetL();
|
|
1295 |
}
|
|
1296 |
else if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0419")) == 0)
|
|
1297 |
{
|
|
1298 |
SetContentAlignmentL();
|
|
1299 |
}
|
|
1300 |
|
|
1301 |
SetScaleFactorL();
|
|
1302 |
|
|
1303 |
// Start video playback
|
|
1304 |
StartPlayback();
|
|
1305 |
}
|
|
1306 |
|
|
1307 |
/**
|
|
1308 |
* RTestVclnt2SettingsAndAlignments::HandlePlayCompleteL
|
|
1309 |
*/
|
|
1310 |
void RTestVclnt2SettingsAndAlignments::HandlePlayCompleteL()
|
|
1311 |
{
|
|
1312 |
iCount++;
|
|
1313 |
|
|
1314 |
if (iCount == KSettingsAndAlignmentTest)
|
|
1315 |
{
|
|
1316 |
iTestStepResult = EPass;
|
|
1317 |
CActiveScheduler::Stop();
|
|
1318 |
}
|
|
1319 |
else
|
|
1320 |
{
|
|
1321 |
HandlePrepareCompleteL();
|
|
1322 |
}
|
|
1323 |
}
|
|
1324 |
|
|
1325 |
/**
|
|
1326 |
* RTestVclnt2SettingsAndAlignments::SetCropRegionL
|
|
1327 |
*/
|
|
1328 |
void RTestVclnt2SettingsAndAlignments::SetCropRegionL(TRect& aCropRegion)
|
|
1329 |
{
|
|
1330 |
// retrieve the current frame size
|
|
1331 |
TSize frameSize;
|
|
1332 |
iVideoPlayer2->VideoFrameSizeL(frameSize);
|
|
1333 |
|
|
1334 |
// Framesize is used in this case as crop region is not returning default values
|
|
1335 |
aCropRegion.SetRect(TPoint(0, 0), frameSize);
|
|
1336 |
|
|
1337 |
// set the crop region
|
|
1338 |
switch (iCount % KSettingsAndAlignmentTest)
|
|
1339 |
{
|
|
1340 |
case 0:
|
|
1341 |
// set the crop region to the top half of the image
|
|
1342 |
aCropRegion.SetHeight(aCropRegion.Height() / 2);
|
|
1343 |
iVideoPlayer2->SetCropRegionL(aCropRegion);
|
|
1344 |
break;
|
|
1345 |
|
|
1346 |
case 1:
|
|
1347 |
// set the crop region to the left half of the image
|
|
1348 |
aCropRegion.SetWidth(aCropRegion.Width() / 2);
|
|
1349 |
iVideoPlayer2->SetCropRegionL(aCropRegion);
|
|
1350 |
break;
|
|
1351 |
|
|
1352 |
default:
|
|
1353 |
// set the crop region to the bottom, right quarter of the image
|
|
1354 |
aCropRegion.SetHeight(aCropRegion.Height() / 2);
|
|
1355 |
aCropRegion.SetWidth(aCropRegion.Width() / 2);
|
|
1356 |
aCropRegion.Move(aCropRegion.Width(), aCropRegion.Height());
|
|
1357 |
iVideoPlayer2->SetCropRegionL(aCropRegion);
|
|
1358 |
break;
|
|
1359 |
}
|
|
1360 |
}
|
|
1361 |
|
|
1362 |
/**
|
|
1363 |
* RTestVclnt2SettingsAndAlignments::SetContentOffsetL
|
|
1364 |
*/
|
|
1365 |
void RTestVclnt2SettingsAndAlignments::SetContentOffsetL()
|
|
1366 |
{
|
|
1367 |
switch (iCount % KSettingsAndAlignmentTest)
|
|
1368 |
{
|
|
1369 |
case 0:
|
|
1370 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 0, 100);
|
|
1371 |
break;
|
|
1372 |
|
|
1373 |
case 1:
|
|
1374 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 0);
|
|
1375 |
break;
|
|
1376 |
|
|
1377 |
default:
|
|
1378 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 100);
|
|
1379 |
break;
|
|
1380 |
}
|
|
1381 |
}
|
|
1382 |
|
|
1383 |
/**
|
|
1384 |
* RTestVclnt2SettingsAndAlignments::SetContentAlignmentL
|
|
1385 |
*/
|
|
1386 |
void RTestVclnt2SettingsAndAlignments::SetContentAlignmentL()
|
|
1387 |
{
|
|
1388 |
switch (iCount % KSettingsAndAlignmentTest)
|
|
1389 |
{
|
|
1390 |
case 0:
|
|
1391 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 0, EVerticalAlignCenter);
|
|
1392 |
break;
|
|
1393 |
|
|
1394 |
case 1:
|
|
1395 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, 0);
|
|
1396 |
break;
|
|
1397 |
|
|
1398 |
default:
|
|
1399 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignCenter);
|
|
1400 |
break;
|
|
1401 |
}
|
|
1402 |
}
|
|
1403 |
|
|
1404 |
/**
|
|
1405 |
* RTestVclnt2SettingsAndAlignments::SetScaleFactorL
|
|
1406 |
*/
|
|
1407 |
void RTestVclnt2SettingsAndAlignments::SetScaleFactorL()
|
|
1408 |
{
|
|
1409 |
switch (iCount % KSettingsAndAlignmentTest)
|
|
1410 |
{
|
|
1411 |
case 0:
|
|
1412 |
iVideoPlayer2->SetScaleFactorL(*iWindow, 1, 200);
|
|
1413 |
break;
|
|
1414 |
|
|
1415 |
case 1:
|
|
1416 |
iVideoPlayer2->SetScaleFactorL(*iWindow, 200, 1);
|
|
1417 |
break;
|
|
1418 |
|
|
1419 |
default:
|
|
1420 |
iVideoPlayer2->SetScaleFactorL(*iWindow, 200, 200);
|
|
1421 |
break;
|
|
1422 |
}
|
|
1423 |
}
|
|
1424 |
|
|
1425 |
/**
|
|
1426 |
* RTestVclnt2SettingsAndAlignments::AddDisplayWindowL
|
|
1427 |
*/
|
|
1428 |
void RTestVclnt2SettingsAndAlignments::AddDisplayWindowL(const TRect& aCropRegion)
|
|
1429 |
{
|
|
1430 |
TRect videoExtentRect(iWindow->Size());
|
|
1431 |
TRect clippingRect(iWindow->Size());
|
|
1432 |
|
|
1433 |
switch (iCount % KSettingsAndAlignmentTest)
|
|
1434 |
{
|
|
1435 |
case 0:
|
|
1436 |
videoExtentRect.SetWidth(aCropRegion.Width());
|
|
1437 |
if (iWindow->Size().iWidth > videoExtentRect.Width())
|
|
1438 |
{
|
|
1439 |
videoExtentRect.Move((iWindow->Size().iWidth - videoExtentRect.Width()) / 2, 0);
|
|
1440 |
}
|
|
1441 |
clippingRect = videoExtentRect;
|
|
1442 |
break;
|
|
1443 |
|
|
1444 |
case 1:
|
|
1445 |
videoExtentRect.SetHeight(aCropRegion.Height());
|
|
1446 |
if (iWindow->Size().iHeight > videoExtentRect.Height())
|
|
1447 |
{
|
|
1448 |
videoExtentRect.Move(0, (iWindow->Size().iHeight - videoExtentRect.Height()) / 2);
|
|
1449 |
}
|
|
1450 |
clippingRect = videoExtentRect;
|
|
1451 |
break;
|
|
1452 |
|
|
1453 |
default:
|
|
1454 |
clippingRect.SetHeight(clippingRect.Height() / 2);
|
|
1455 |
clippingRect.SetWidth(clippingRect.Width() / 2);
|
|
1456 |
clippingRect.Move(clippingRect.Width(), clippingRect.Height());
|
|
1457 |
break;
|
|
1458 |
}
|
|
1459 |
|
|
1460 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1461 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtentRect, clippingRect);
|
|
1462 |
}
|
|
1463 |
|
|
1464 |
|
|
1465 |
//
|
|
1466 |
// RTestVclnt2SecDisplay
|
|
1467 |
//
|
|
1468 |
/**
|
|
1469 |
* RTestVclnt2SecDisplay::Constructor
|
|
1470 |
*/
|
|
1471 |
RTestVclnt2SecDisplay::RTestVclnt2SecDisplay(const TDesC& aTestName,
|
|
1472 |
const TDesC& aSectName,
|
|
1473 |
const TDesC& aKeyName,
|
|
1474 |
TInt aExpectedError)
|
|
1475 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1476 |
{
|
|
1477 |
}
|
|
1478 |
|
|
1479 |
/**
|
|
1480 |
* RTestVclnt2SecDisplay::NewL
|
|
1481 |
*/
|
|
1482 |
RTestVclnt2SecDisplay* RTestVclnt2SecDisplay::NewL(const TDesC& aTestName,
|
|
1483 |
const TDesC& aSectName,
|
|
1484 |
const TDesC& aKeyName,
|
|
1485 |
TInt aExpectedError)
|
|
1486 |
{
|
|
1487 |
RTestVclnt2SecDisplay* self = new (ELeave) RTestVclnt2SecDisplay(aTestName, aSectName, aKeyName, aExpectedError);
|
|
1488 |
return self;
|
|
1489 |
}
|
|
1490 |
|
|
1491 |
/**
|
|
1492 |
* RTestVclnt2SecDisplay::DoTestStepPreambleL
|
|
1493 |
*/
|
|
1494 |
TVerdict RTestVclnt2SecDisplay::DoTestStepPreambleL()
|
|
1495 |
{
|
|
1496 |
TVerdict verdict = RTestVclnt2PlayFile::DoTestStepPreambleL();
|
|
1497 |
if (verdict == EPass)
|
|
1498 |
{
|
|
1499 |
// make a 2nd device for this session
|
|
1500 |
iSecondScreen = new (ELeave) CWsScreenDevice(iWs);
|
|
1501 |
User::LeaveIfError(iSecondScreen->Construct());
|
|
1502 |
}
|
|
1503 |
|
|
1504 |
return verdict;
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
/**
|
|
1508 |
* RTestVclnt2SecDisplay::DoTestStepPostambleL
|
|
1509 |
*/
|
|
1510 |
TVerdict RTestVclnt2SecDisplay::DoTestStepPostambleL()
|
|
1511 |
{
|
|
1512 |
delete iSecondScreen;
|
|
1513 |
|
|
1514 |
return EPass;
|
|
1515 |
}
|
|
1516 |
|
|
1517 |
/**
|
|
1518 |
* RTestVclnt2SecDisplay::HandlePrepareCompleteL
|
|
1519 |
*/
|
|
1520 |
void RTestVclnt2SecDisplay::HandlePrepareCompleteL()
|
|
1521 |
{
|
|
1522 |
// Add display window using default values - ie. video extent & window clipping
|
|
1523 |
// defaulted to whole window
|
|
1524 |
INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
|
|
1525 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iSecondScreen, *iWindow);
|
|
1526 |
|
|
1527 |
// trigger the video to start playing
|
|
1528 |
StartPlayback();
|
|
1529 |
}
|
|
1530 |
|
|
1531 |
|
|
1532 |
//
|
|
1533 |
// RTestVclnt2CropRectPause
|
|
1534 |
//
|
|
1535 |
/**
|
|
1536 |
* RTestVclnt2CropRectPause::Constructor
|
|
1537 |
*/
|
|
1538 |
RTestVclnt2CropRectPause::RTestVclnt2CropRectPause(const TDesC& aTestName,
|
|
1539 |
const TDesC& aSectName,
|
|
1540 |
const TDesC& aKeyName,
|
|
1541 |
TInt aExpectedError)
|
|
1542 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1543 |
{
|
|
1544 |
}
|
|
1545 |
|
|
1546 |
/**
|
|
1547 |
* RTestVclnt2CropRectPause::NewL
|
|
1548 |
*/
|
|
1549 |
RTestVclnt2CropRectPause* RTestVclnt2CropRectPause::NewL(const TDesC& aTestName,
|
|
1550 |
const TDesC& aSectName,
|
|
1551 |
const TDesC& aKeyName,
|
|
1552 |
TInt aExpectedError)
|
|
1553 |
{
|
|
1554 |
RTestVclnt2CropRectPause* self
|
|
1555 |
= new (ELeave) RTestVclnt2CropRectPause(aTestName, aSectName, aKeyName, aExpectedError);
|
|
1556 |
return self;
|
|
1557 |
}
|
|
1558 |
|
|
1559 |
/**
|
|
1560 |
* RTestVclnt2CropRectPause::DoThisActionDuringPlaybackL
|
|
1561 |
*/
|
|
1562 |
void RTestVclnt2CropRectPause::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
|
|
1563 |
{
|
|
1564 |
TRect cropRegion;
|
|
1565 |
aPlayer.GetCropRegionL(cropRegion);
|
|
1566 |
|
|
1567 |
// change the crop region and continue to play the clip
|
|
1568 |
cropRegion.SetHeight(cropRegion.Height() / 2);
|
|
1569 |
aPlayer.SetCropRegionL(cropRegion);
|
|
1570 |
}
|
|
1571 |
|
|
1572 |
|
|
1573 |
|
|
1574 |
//
|
|
1575 |
// RTestVclnt2Overlay
|
|
1576 |
//
|
|
1577 |
/**
|
|
1578 |
* RTestVclnt2Overlay::Constructor
|
|
1579 |
*/
|
|
1580 |
RTestVclnt2Overlay::RTestVclnt2Overlay(const TDesC& aTestName,
|
|
1581 |
const TDesC& aSectName,
|
|
1582 |
const TDesC& aKeyName,
|
|
1583 |
TInt aExpectedError)
|
|
1584 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1585 |
{
|
|
1586 |
}
|
|
1587 |
|
|
1588 |
/**
|
|
1589 |
* RTestVclnt2Overlay::NewL
|
|
1590 |
*/
|
|
1591 |
RTestVclnt2Overlay* RTestVclnt2Overlay::NewL(const TDesC& aTestName,
|
|
1592 |
const TDesC& aSectName,
|
|
1593 |
const TDesC& aKeyName,
|
|
1594 |
TInt aExpectedError)
|
|
1595 |
{
|
|
1596 |
RTestVclnt2Overlay* self = new (ELeave) RTestVclnt2Overlay(aTestName,
|
|
1597 |
aSectName,
|
|
1598 |
aKeyName,
|
|
1599 |
aExpectedError);
|
|
1600 |
return self;
|
|
1601 |
}
|
|
1602 |
|
|
1603 |
/**
|
|
1604 |
* RTestVclnt2Overlay::DoTestStepPreambleL
|
|
1605 |
*/
|
|
1606 |
TVerdict RTestVclnt2Overlay::DoTestStepPreambleL()
|
|
1607 |
{
|
|
1608 |
TVerdict verdict = RTestVclnt2PlayFile::DoTestStepPreambleL();
|
|
1609 |
if (verdict == EPass)
|
|
1610 |
{
|
|
1611 |
TFontSpec fontSpec; // use default fonts
|
|
1612 |
fontSpec.iHeight = 20;
|
|
1613 |
|
|
1614 |
// Get a font to draw overlay text
|
|
1615 |
if (iScreen->GetNearestFontToDesignHeightInPixels(iFont, fontSpec) != KErrNone)
|
|
1616 |
{
|
|
1617 |
// if no font can be retrieved, abort the test
|
|
1618 |
ERR_PRINTF1(_L("Cannot retrieve font to perform test. Test aborted."));
|
|
1619 |
|
|
1620 |
return EInconclusive;
|
|
1621 |
}
|
|
1622 |
|
|
1623 |
iGc->Activate(*iWindow);
|
|
1624 |
iGc->UseFont(iFont);
|
|
1625 |
}
|
|
1626 |
|
|
1627 |
return verdict;
|
|
1628 |
}
|
|
1629 |
|
|
1630 |
/**
|
|
1631 |
* RTestVclnt2Overlay::DoTestStepPostambleL
|
|
1632 |
*/
|
|
1633 |
TVerdict RTestVclnt2Overlay::DoTestStepPostambleL()
|
|
1634 |
{
|
|
1635 |
iGc->DiscardFont();
|
|
1636 |
iGc->Deactivate();
|
|
1637 |
|
|
1638 |
return RTestVclnt2PlayFile::DoTestStepPostambleL();
|
|
1639 |
}
|
|
1640 |
|
|
1641 |
/**
|
|
1642 |
* RTestVclnt2Overlay::HandlePrepareCompleteL
|
|
1643 |
*/
|
|
1644 |
void RTestVclnt2Overlay::HandlePrepareCompleteL()
|
|
1645 |
{
|
|
1646 |
TRect rect(iWindow->Size());
|
|
1647 |
TInt baseline = (rect.Height() + iFont->AscentInPixels()) >> 1;
|
|
1648 |
|
|
1649 |
// Draw the overlay text if needed
|
|
1650 |
iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
|
|
1651 |
iGc->SetBrushColor(KRgbRed);
|
|
1652 |
|
|
1653 |
iGc->SetPenStyle(CGraphicsContext::ESolidPen);
|
|
1654 |
iGc->SetPenColor(KRgbBlue);
|
|
1655 |
|
|
1656 |
iGc->DrawText(_L("Overlay Testing"), rect, baseline, CGraphicsContext::ELeft);
|
|
1657 |
|
|
1658 |
// setup the display window and trigger the video to start playing
|
|
1659 |
RTestVclnt2PlayFile::HandlePrepareCompleteL();
|
|
1660 |
}
|
|
1661 |
|
|
1662 |
|
|
1663 |
//
|
|
1664 |
// RTestVclnt2AddWin2
|
|
1665 |
//
|
|
1666 |
|
|
1667 |
/**
|
|
1668 |
* RTestVclnt2AddWin2::Constructor
|
|
1669 |
*/
|
|
1670 |
RTestVclnt2AddWin2::RTestVclnt2AddWin2(const TDesC& aTestName,
|
|
1671 |
const TDesC& aSectName,
|
|
1672 |
const TDesC& aKeyName,
|
|
1673 |
TInt aExpectedError)
|
|
1674 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1675 |
{
|
|
1676 |
}
|
|
1677 |
|
|
1678 |
/**
|
|
1679 |
* RTestVclnt2AddWin2::NewL
|
|
1680 |
*/
|
|
1681 |
RTestVclnt2AddWin2* RTestVclnt2AddWin2::NewL(const TDesC& aTestName,
|
|
1682 |
const TDesC& aSectName,
|
|
1683 |
const TDesC& aKeyName,
|
|
1684 |
TInt aExpectedError)
|
|
1685 |
{
|
|
1686 |
RTestVclnt2AddWin2* self = new (ELeave) RTestVclnt2AddWin2(aTestName,
|
|
1687 |
aSectName,
|
|
1688 |
aKeyName,
|
|
1689 |
aExpectedError);
|
|
1690 |
return self;
|
|
1691 |
}
|
|
1692 |
|
|
1693 |
/**
|
|
1694 |
* RTestVclnt2AddWin2::HandlePrepareCompleteL
|
|
1695 |
*/
|
|
1696 |
void RTestVclnt2AddWin2::HandlePrepareCompleteL()
|
|
1697 |
{
|
|
1698 |
// add the display window for the player to use for displaying the video
|
|
1699 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
1700 |
|
|
1701 |
// Add the same display window again
|
|
1702 |
TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
|
|
1703 |
if (err != iTestExpectedError)
|
|
1704 |
{
|
|
1705 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
|
|
1706 |
|
|
1707 |
iTestStepResult = EFail;
|
|
1708 |
CActiveScheduler::Stop();
|
|
1709 |
|
|
1710 |
return;
|
|
1711 |
}
|
|
1712 |
else
|
|
1713 |
{
|
|
1714 |
INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an expected error. Test continues."));
|
|
1715 |
|
|
1716 |
// reset the expected error. Any error that appears after this should fail the test
|
|
1717 |
iTestExpectedError = KErrNone;
|
|
1718 |
}
|
|
1719 |
|
|
1720 |
// trigger the video to start playing
|
|
1721 |
StartPlayback();
|
|
1722 |
}
|
|
1723 |
|
|
1724 |
//
|
|
1725 |
// RTestVclnt2AddWin2WithSettings
|
|
1726 |
//
|
|
1727 |
|
|
1728 |
/**
|
|
1729 |
* RTestVclnt2AddWin2WithSettings::Constructor
|
|
1730 |
*/
|
|
1731 |
RTestVclnt2AddWin2WithSettings::RTestVclnt2AddWin2WithSettings(const TDesC& aTestName,
|
|
1732 |
const TDesC& aSectName,
|
|
1733 |
const TDesC& aKeyName,
|
|
1734 |
TInt aExpectedError)
|
|
1735 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1736 |
{
|
|
1737 |
}
|
|
1738 |
|
|
1739 |
/**
|
|
1740 |
* RTestVclnt2AddWin2WithSettings::NewL
|
|
1741 |
*/
|
|
1742 |
RTestVclnt2AddWin2WithSettings* RTestVclnt2AddWin2WithSettings::NewL(const TDesC& aTestName,
|
|
1743 |
const TDesC& aSectName,
|
|
1744 |
const TDesC& aKeyName,
|
|
1745 |
TInt aExpectedError)
|
|
1746 |
{
|
|
1747 |
RTestVclnt2AddWin2WithSettings* self = new (ELeave) RTestVclnt2AddWin2WithSettings(aTestName,
|
|
1748 |
aSectName,
|
|
1749 |
aKeyName,
|
|
1750 |
aExpectedError);
|
|
1751 |
return self;
|
|
1752 |
}
|
|
1753 |
|
|
1754 |
/**
|
|
1755 |
* RTestVclnt2AddWin2WithSettings::HandlePrepareCompleteL
|
|
1756 |
*/
|
|
1757 |
void RTestVclnt2AddWin2WithSettings::HandlePrepareCompleteL()
|
|
1758 |
{
|
|
1759 |
TRect windowRect(iWindow->Size());
|
|
1760 |
windowRect.SetHeight(windowRect.Height() / 2);
|
|
1761 |
|
|
1762 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, windowRect, windowRect);
|
|
1763 |
|
|
1764 |
// Add the same display window again with default values
|
|
1765 |
TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
|
|
1766 |
if (err != iTestExpectedError)
|
|
1767 |
{
|
|
1768 |
ERR_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an unexpected error. Test failed."));
|
|
1769 |
|
|
1770 |
iTestStepResult = EFail;
|
|
1771 |
CActiveScheduler::Stop();
|
|
1772 |
|
|
1773 |
return;
|
|
1774 |
}
|
|
1775 |
else
|
|
1776 |
{
|
|
1777 |
INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL() leaves with an expected error. Test continues."));
|
|
1778 |
|
|
1779 |
// reset the expected error. Any error that appears after this should fail the test
|
|
1780 |
iTestExpectedError = KErrNone;
|
|
1781 |
}
|
|
1782 |
|
|
1783 |
// trigger the video to start playing
|
|
1784 |
StartPlayback();
|
|
1785 |
}
|
|
1786 |
|
|
1787 |
//
|
|
1788 |
// RTestVclnt2ContOffset
|
|
1789 |
//
|
|
1790 |
|
|
1791 |
/**
|
|
1792 |
* RTestVclnt2ContOffset::Constructor
|
|
1793 |
*/
|
|
1794 |
RTestVclnt2ContOffset::RTestVclnt2ContOffset(const TDesC& aTestName,
|
|
1795 |
const TDesC& aSectName,
|
|
1796 |
const TDesC& aKeyName,
|
|
1797 |
TInt aExpectedError)
|
|
1798 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1799 |
{
|
|
1800 |
iHeapSize = 2000000; //~2MB
|
|
1801 |
}
|
|
1802 |
|
|
1803 |
/**
|
|
1804 |
* RTestVclnt2ContOffset::NewL
|
|
1805 |
*/
|
|
1806 |
RTestVclnt2ContOffset* RTestVclnt2ContOffset::NewL(const TDesC& aTestName,
|
|
1807 |
const TDesC& aSectName,
|
|
1808 |
const TDesC& aKeyName,
|
|
1809 |
TInt aExpectedError)
|
|
1810 |
{
|
|
1811 |
RTestVclnt2ContOffset* self = new (ELeave) RTestVclnt2ContOffset(aTestName,
|
|
1812 |
aSectName,
|
|
1813 |
aKeyName,
|
|
1814 |
aExpectedError);
|
|
1815 |
return self;
|
|
1816 |
}
|
|
1817 |
|
|
1818 |
/**
|
|
1819 |
* RTestVclnt2ContOffset::HandlePrepareCompleteL
|
|
1820 |
*/
|
|
1821 |
void RTestVclnt2ContOffset::HandlePrepareCompleteL()
|
|
1822 |
{
|
|
1823 |
// call parent's HandlePrepareCompleteL to finish off all preparation
|
|
1824 |
RTestVclnt2PlayFile::HandlePrepareCompleteL();
|
|
1825 |
// Set the content offset before starting to play the video.
|
|
1826 |
INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
|
|
1827 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 100, 100);
|
|
1828 |
|
|
1829 |
if (iTestStepName.CompareF(_L("MM-MMF-VCLNTAVI-I-0409")) == 0)
|
|
1830 |
{
|
|
1831 |
// Set the content alignment after setting the content offset
|
|
1832 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignTop);
|
|
1833 |
}
|
|
1834 |
}
|
|
1835 |
|
|
1836 |
//
|
|
1837 |
// RTestVclnt2ContOffsetAtPlay
|
|
1838 |
//
|
|
1839 |
/**
|
|
1840 |
* RTestVclnt2ContOffsetAtPlay::Constructor
|
|
1841 |
*/
|
|
1842 |
RTestVclnt2ContOffsetAtPlay::RTestVclnt2ContOffsetAtPlay(const TDesC& aTestName,
|
|
1843 |
const TDesC& aSectName,
|
|
1844 |
const TDesC& aKeyName,
|
|
1845 |
TInt aExpectedError)
|
|
1846 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1847 |
{
|
|
1848 |
iHeapSize = 2000000; //~2MB
|
|
1849 |
}
|
|
1850 |
|
|
1851 |
/**
|
|
1852 |
* RTestVclnt2ContOffsetAtPlay::NewL
|
|
1853 |
*/
|
|
1854 |
RTestVclnt2ContOffsetAtPlay* RTestVclnt2ContOffsetAtPlay::NewL(const TDesC& aTestName,
|
|
1855 |
const TDesC& aSectName,
|
|
1856 |
const TDesC& aKeyName,
|
|
1857 |
TInt aExpectedError)
|
|
1858 |
{
|
|
1859 |
RTestVclnt2ContOffsetAtPlay* self = new (ELeave) RTestVclnt2ContOffsetAtPlay(aTestName,
|
|
1860 |
aSectName,
|
|
1861 |
aKeyName,
|
|
1862 |
aExpectedError);
|
|
1863 |
return self;
|
|
1864 |
}
|
|
1865 |
|
|
1866 |
/**
|
|
1867 |
* RTestVclnt2ContOffsetAtPlay::DoThisActionDuringPlaybackL
|
|
1868 |
*/
|
|
1869 |
void RTestVclnt2ContOffsetAtPlay::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& /* aPlayer */)
|
|
1870 |
{
|
|
1871 |
// Change the scale factor during playback
|
|
1872 |
INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
|
|
1873 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, 10, 10);
|
|
1874 |
}
|
|
1875 |
|
|
1876 |
|
|
1877 |
//
|
|
1878 |
// RTestVclnt2Align
|
|
1879 |
//
|
|
1880 |
/**
|
|
1881 |
* RTestVclnt2Align::Constructor
|
|
1882 |
*/
|
|
1883 |
RTestVclnt2Align::RTestVclnt2Align(const TDesC& aTestName,
|
|
1884 |
const TDesC& aSectName,
|
|
1885 |
const TDesC& aKeyName,
|
|
1886 |
TInt aExpectedError)
|
|
1887 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1888 |
{
|
|
1889 |
iHeapSize = 2000000; //~2MB
|
|
1890 |
}
|
|
1891 |
|
|
1892 |
/**
|
|
1893 |
* RTestVclnt2Align::NewL
|
|
1894 |
*/
|
|
1895 |
RTestVclnt2Align* RTestVclnt2Align::NewL(const TDesC& aTestName,
|
|
1896 |
const TDesC& aSectName,
|
|
1897 |
const TDesC& aKeyName,
|
|
1898 |
TInt aExpectedError)
|
|
1899 |
{
|
|
1900 |
RTestVclnt2Align* self = new (ELeave) RTestVclnt2Align(aTestName, aSectName, aKeyName, aExpectedError);
|
|
1901 |
return self;
|
|
1902 |
}
|
|
1903 |
|
|
1904 |
/**
|
|
1905 |
* RTestVclnt2Align::HandlePrepareCompleteL
|
|
1906 |
*/
|
|
1907 |
void RTestVclnt2Align::HandlePrepareCompleteL()
|
|
1908 |
{
|
|
1909 |
// Continue to setup the video utility and then trigger playback
|
|
1910 |
RTestVclnt2PlayFile::HandlePrepareCompleteL();
|
|
1911 |
// Set the content offset before starting to play the video.
|
|
1912 |
INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
|
|
1913 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignCenter);
|
|
1914 |
}
|
|
1915 |
|
|
1916 |
/**
|
|
1917 |
* RTestVclnt2Align::DoThisActionDuringPlaybackL
|
|
1918 |
*/
|
|
1919 |
void RTestVclnt2Align::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& /* aPlayer */)
|
|
1920 |
{
|
|
1921 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignCenter);
|
|
1922 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1923 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(10, 10, 100, 100), TRect(0, 3, 4, 220));
|
|
1924 |
|
|
1925 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignCenter);
|
|
1926 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1927 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
1928 |
|
|
1929 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignTop);
|
|
1930 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1931 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(10, 10, 100, 100), TRect(0, 5, 5, 200));
|
|
1932 |
|
|
1933 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignTop);
|
|
1934 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1935 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
1936 |
|
|
1937 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignTop);
|
|
1938 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1939 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(0, 0, 100, 100), TRect(0, 5, 5, 200));
|
|
1940 |
|
|
1941 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignCenter, EVerticalAlignBottom);
|
|
1942 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1943 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
1944 |
|
|
1945 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignLeft, EVerticalAlignBottom);
|
|
1946 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1947 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, TRect(0, 0, 100, 100), TRect(0, 5, 300, 230));
|
|
1948 |
|
|
1949 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleNone, EHorizontalAlignRight, EVerticalAlignBottom);
|
|
1950 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
1951 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
1952 |
}
|
|
1953 |
|
|
1954 |
|
|
1955 |
//
|
|
1956 |
// RTestVclnt2AutoScale
|
|
1957 |
//
|
|
1958 |
/**
|
|
1959 |
* RTestVclnt2AutoScale::Constructor
|
|
1960 |
*/
|
|
1961 |
RTestVclnt2AutoScale::RTestVclnt2AutoScale(const TDesC& aTestName,
|
|
1962 |
const TDesC& aSectName,
|
|
1963 |
const TDesC& aKeyName,
|
|
1964 |
TInt aExpectedError)
|
|
1965 |
: RTestVclnt2PerformActionDuringVideoPlayback(aTestName, aSectName, aKeyName, aExpectedError)
|
|
1966 |
{
|
|
1967 |
iHeapSize = 2000000; //~2MB
|
|
1968 |
}
|
|
1969 |
|
|
1970 |
/**
|
|
1971 |
* RTestVclnt2AutoScale::NewL
|
|
1972 |
*/
|
|
1973 |
RTestVclnt2AutoScale* RTestVclnt2AutoScale::NewL(const TDesC& aTestName,
|
|
1974 |
const TDesC& aSectName,
|
|
1975 |
const TDesC& aKeyName,
|
|
1976 |
TInt aExpectedError)
|
|
1977 |
{
|
|
1978 |
RTestVclnt2AutoScale* self = new (ELeave) RTestVclnt2AutoScale(aTestName, aSectName, aKeyName, aExpectedError);
|
|
1979 |
return self;
|
|
1980 |
}
|
|
1981 |
|
|
1982 |
/**
|
|
1983 |
* RTestVclnt2AutoScale::HandlePrepareCompleteL
|
|
1984 |
*/
|
|
1985 |
void RTestVclnt2AutoScale::HandlePrepareCompleteL()
|
|
1986 |
{
|
|
1987 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
1988 |
// Set the content offset before starting to play the video.
|
|
1989 |
INFO_PRINTF1(_L("iVideoPlayer2->SetAutoScale()"));
|
|
1990 |
iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleClip);
|
|
1991 |
|
|
1992 |
// trigger the video to start playing
|
|
1993 |
StartPlayback();
|
|
1994 |
}
|
|
1995 |
|
|
1996 |
/**
|
|
1997 |
* RTestVclnt2AutoScale::DoThisActionDuringPlaybackL
|
|
1998 |
*/
|
|
1999 |
void RTestVclnt2AutoScale::DoThisActionDuringPlaybackL(CVideoPlayerUtility2& aPlayer)
|
|
2000 |
{
|
|
2001 |
aPlayer.SetAutoScaleL(*iWindow, EAutoScaleBestFit);
|
|
2002 |
aPlayer.SetAutoScaleL(*iWindow, EAutoScaleNone);
|
|
2003 |
aPlayer.SetAutoScaleL(*iWindow, EAutoScaleStretch);
|
|
2004 |
}
|
|
2005 |
|
|
2006 |
//
|
|
2007 |
// RTestVclnt2OldController
|
|
2008 |
//
|
|
2009 |
|
|
2010 |
RTestVclnt2OldController::RTestVclnt2OldController(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2011 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
2012 |
{
|
|
2013 |
}
|
|
2014 |
|
|
2015 |
/**
|
|
2016 |
* RTestVclnt2OldController::NewL
|
|
2017 |
*/
|
|
2018 |
RTestVclnt2OldController* RTestVclnt2OldController::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2019 |
{
|
|
2020 |
RTestVclnt2OldController* self = new (ELeave) RTestVclnt2OldController(aTestName, aSectName, aKeyName, aExpectedError);
|
|
2021 |
return self;
|
|
2022 |
}
|
|
2023 |
|
|
2024 |
void RTestVclnt2OldController::HandleIdleL()
|
|
2025 |
{
|
|
2026 |
// Open iVideoPlayer using a controller that does not support surfaces.
|
|
2027 |
INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
|
|
2028 |
iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviNonGcePlayControllerUid);
|
|
2029 |
PrepareState(EVPOpenComplete, KErrNone);
|
|
2030 |
}
|
|
2031 |
|
|
2032 |
void RTestVclnt2OldController::HandlePrepareCompleteL()
|
|
2033 |
{
|
|
2034 |
TRAPD(err, RTestVclnt2PlayFile::HandlePrepareCompleteL());
|
|
2035 |
|
|
2036 |
if (err != KErrNotSupported)
|
|
2037 |
{
|
|
2038 |
ERR_PRINTF1(_L("AddDisplay did not leave with KErrNotSupported."));
|
|
2039 |
iTestStepResult = EFail;
|
|
2040 |
}
|
|
2041 |
else
|
|
2042 |
{
|
|
2043 |
iTestStepResult = EPass;
|
|
2044 |
}
|
|
2045 |
|
|
2046 |
// Stop the test.
|
|
2047 |
CActiveScheduler::Stop();
|
|
2048 |
}
|
|
2049 |
//
|
|
2050 |
// RTestVclnt2NoFile
|
|
2051 |
//
|
|
2052 |
|
|
2053 |
RTestVclnt2NoFile::RTestVclnt2NoFile(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2054 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
2055 |
{
|
|
2056 |
}
|
|
2057 |
|
|
2058 |
/**
|
|
2059 |
* RTestVclnt2NoFile::NewL
|
|
2060 |
*/
|
|
2061 |
RTestVclnt2NoFile* RTestVclnt2NoFile::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2062 |
{
|
|
2063 |
RTestVclnt2NoFile* self = new (ELeave) RTestVclnt2NoFile(aTestName, aSectName, aKeyName, aExpectedError);
|
|
2064 |
return self;
|
|
2065 |
}
|
|
2066 |
|
|
2067 |
void RTestVclnt2NoFile::HandleIdleL()
|
|
2068 |
{
|
|
2069 |
iTestStepResult = EFail;
|
|
2070 |
TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
|
|
2071 |
|
|
2072 |
if (err != iTestExpectedError)
|
|
2073 |
{
|
|
2074 |
ERR_PRINTF1(_L("AddDisplayWindowL did not leave with KErrNotReady."));
|
|
2075 |
User::Leave(KErrGeneral);
|
|
2076 |
}
|
|
2077 |
|
|
2078 |
TSize windowSize = iWindow->Size();
|
|
2079 |
TRect videoExtent(-5, -5, windowSize.iWidth + 5, windowSize.iHeight + 5);
|
|
2080 |
TRect windowClipRect(5, 5, windowSize.iWidth - 5, windowSize.iHeight - 5);
|
|
2081 |
TRAP(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtent, windowClipRect));
|
|
2082 |
|
|
2083 |
if (err != iTestExpectedError)
|
|
2084 |
{
|
|
2085 |
ERR_PRINTF1(_L("AddDisplayWindowL did not leave with KErrNotReady."));
|
|
2086 |
User::Leave(KErrGeneral);
|
|
2087 |
}
|
|
2088 |
|
|
2089 |
TRAP(err, iVideoPlayer2->SetWindowClipRectL(*iWindow, windowClipRect));
|
|
2090 |
|
|
2091 |
if (err != iTestExpectedError)
|
|
2092 |
{
|
|
2093 |
ERR_PRINTF1(_L("SetWindowClipRectL did not leave with KErrNotReady."));
|
|
2094 |
User::Leave(KErrGeneral);
|
|
2095 |
}
|
|
2096 |
|
|
2097 |
TRAP(err, iVideoPlayer2->SetVideoExtentL(*iWindow, videoExtent));
|
|
2098 |
|
|
2099 |
if (err != iTestExpectedError)
|
|
2100 |
{
|
|
2101 |
ERR_PRINTF1(_L("SetVideoExtentL did not leave with KErrNotReady."));
|
|
2102 |
User::Leave(KErrGeneral);
|
|
2103 |
}
|
|
2104 |
|
|
2105 |
// reset the expected error to KErrNone as any error happens after this is unexpected
|
|
2106 |
iTestExpectedError = KErrNone;
|
|
2107 |
|
|
2108 |
// The video should still play when we try to play the video. Perform
|
|
2109 |
// the basic play test now.
|
|
2110 |
RTestVclnt2PlayFile::HandleIdleL();
|
|
2111 |
}
|
|
2112 |
|
|
2113 |
//
|
|
2114 |
// RTestVclnt2PlayAfterRemoveWin
|
|
2115 |
//
|
|
2116 |
|
|
2117 |
RTestVclnt2PlayAfterRemoveWin::RTestVclnt2PlayAfterRemoveWin(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2118 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
2119 |
{
|
|
2120 |
}
|
|
2121 |
|
|
2122 |
/**
|
|
2123 |
* RTestVclnt2PlayAfterRemoveWin::NewL
|
|
2124 |
*/
|
|
2125 |
RTestVclnt2PlayAfterRemoveWin* RTestVclnt2PlayAfterRemoveWin::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2126 |
{
|
|
2127 |
RTestVclnt2PlayAfterRemoveWin* self = new (ELeave) RTestVclnt2PlayAfterRemoveWin(aTestName, aSectName, aKeyName, aExpectedError);
|
|
2128 |
return self;
|
|
2129 |
}
|
|
2130 |
|
|
2131 |
void RTestVclnt2PlayAfterRemoveWin::HandlePrepareCompleteL()
|
|
2132 |
{
|
|
2133 |
// Don't add a window. Just play the video.
|
|
2134 |
StartPlayback();
|
|
2135 |
}
|
|
2136 |
|
|
2137 |
void RTestVclnt2PlayAfterRemoveWin::HandlePlayCompleteL()
|
|
2138 |
{
|
|
2139 |
switch(iPlayAttempt)
|
|
2140 |
{
|
|
2141 |
case 0:
|
|
2142 |
{
|
|
2143 |
TSize windowSize = iWindow->Size();
|
|
2144 |
TRect videoExtent(-5, -5, windowSize.iWidth + 5, windowSize.iHeight + 5);
|
|
2145 |
TRect windowClipRect(5, 5, windowSize.iWidth - 5, windowSize.iHeight - 5);
|
|
2146 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow, videoExtent, windowClipRect);
|
|
2147 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
2148 |
iVideoPlayer2->Play();
|
|
2149 |
PrepareState(EVPPlayComplete, KErrNone);
|
|
2150 |
break;
|
|
2151 |
}
|
|
2152 |
case 1:
|
|
2153 |
// Removing the window again should have no effect.
|
|
2154 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
|
2155 |
iVideoPlayer2->Play();
|
|
2156 |
PrepareState(EVPPlayComplete, KErrNone);
|
|
2157 |
break;
|
|
2158 |
case 2:
|
|
2159 |
// The previous play commands should have no effect when we try to add a
|
|
2160 |
// display window and render to surfaces. Use the base class to do this.
|
|
2161 |
RTestVclnt2PlayFile::HandlePrepareCompleteL();
|
|
2162 |
break;
|
|
2163 |
default:
|
|
2164 |
// Use the parent handler after we have tried the above play commands.
|
|
2165 |
RTestVclnt2PlayFile::HandlePlayCompleteL();
|
|
2166 |
break;
|
|
2167 |
}
|
|
2168 |
|
|
2169 |
iPlayAttempt++;
|
|
2170 |
}
|
|
2171 |
|
|
2172 |
//
|
|
2173 |
// RTestVclnt2NoGce
|
|
2174 |
//
|
|
2175 |
|
|
2176 |
RTestVclnt2NoGce::RTestVclnt2NoGce(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2177 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
2178 |
{
|
|
2179 |
}
|
|
2180 |
|
|
2181 |
/**
|
|
2182 |
* RTestVclnt2NoGce::NewL
|
|
2183 |
*/
|
|
2184 |
RTestVclnt2NoGce* RTestVclnt2NoGce::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2185 |
{
|
|
2186 |
RTestVclnt2NoGce* self = new (ELeave) RTestVclnt2NoGce(aTestName, aSectName, aKeyName, aExpectedError);
|
|
2187 |
return self;
|
|
2188 |
}
|
|
2189 |
|
|
2190 |
void RTestVclnt2NoGce::HandleIdleL()
|
|
2191 |
{
|
|
2192 |
// Open iVideoPlayer
|
|
2193 |
INFO_PRINTF2(_L("iVideoPlayer2->OpenFileL() %S"), &iFilename);
|
|
2194 |
iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid);
|
|
2195 |
PrepareState(EVPOpenComplete, KErrNotSupported);
|
|
2196 |
}
|
|
2197 |
|
|
2198 |
void RTestVclnt2NoGce::HandleOpenCompleteL()
|
|
2199 |
{
|
|
2200 |
iTestStepResult = EPass;
|
|
2201 |
CActiveScheduler::Stop();
|
|
2202 |
}
|
|
2203 |
|
|
2204 |
//
|
|
2205 |
// RTestVclnt2Alloc
|
|
2206 |
//
|
|
2207 |
|
|
2208 |
RTestVclnt2Alloc::RTestVclnt2Alloc(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2209 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
2210 |
{
|
|
2211 |
}
|
|
2212 |
|
|
2213 |
/**
|
|
2214 |
* RTestVclnt2Alloc::NewL
|
|
2215 |
*/
|
|
2216 |
RTestVclnt2Alloc* RTestVclnt2Alloc::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2217 |
{
|
|
2218 |
RTestVclnt2Alloc* self = new (ELeave) RTestVclnt2Alloc(aTestName, aSectName, aKeyName, aExpectedError);
|
|
2219 |
return self;
|
|
2220 |
}
|
|
2221 |
|
|
2222 |
TVerdict RTestVclnt2Alloc::DoTestStepPreambleL()
|
|
2223 |
{
|
|
2224 |
INFO_PRINTF1(_L("RTestVclnt2Alloc::DoTestStepPreambleL()"));
|
|
2225 |
|
|
2226 |
// Call RTestMmfVclntAviStep::DoTestStepPreambleL instead of the immediate parent's
|
|
2227 |
// DoTestStepPreambleL as there is no need for CVideoPlayerUtility setup.
|
|
2228 |
// Similarly, there is no need to initialize CVideoPlayerUtility2, as it will be
|
|
2229 |
// created in each alloc iteration.
|
|
2230 |
return RTestMmfVclntAviStep::DoTestStepPreambleL();
|
|
2231 |
}
|
|
2232 |
|
|
2233 |
TVerdict RTestVclnt2Alloc::PerformTestL()
|
|
2234 |
{
|
|
2235 |
iVideoPlayer2 = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
|
|
2236 |
ResetState();
|
|
2237 |
iError = KErrNone;
|
|
2238 |
TVerdict result = RTestVclnt2AviPlayerStep::DoTestStepL();
|
|
2239 |
delete iVideoPlayer2;
|
|
2240 |
iVideoPlayer2 = NULL;
|
|
2241 |
return result;
|
|
2242 |
}
|
|
2243 |
|
|
2244 |
/**
|
|
2245 |
* RTestVclnt2Alloc::DoTestStepL()
|
|
2246 |
*/
|
|
2247 |
TVerdict RTestVclnt2Alloc::DoTestStepL()
|
|
2248 |
{
|
|
2249 |
TVerdict allocTestStepResult = EPass;
|
|
2250 |
TInt err = KErrNone;
|
|
2251 |
TBool result = EFalse;
|
|
2252 |
|
|
2253 |
//>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
2254 |
if (PerformTestL() != EPass)
|
|
2255 |
{
|
|
2256 |
err = iError;
|
|
2257 |
}
|
|
2258 |
|
|
2259 |
if (err != KErrNone)
|
|
2260 |
{
|
|
2261 |
INFO_PRINTF2(_L("Test error, returned error code = %d"), err);
|
|
2262 |
User::Leave(err);
|
|
2263 |
}
|
|
2264 |
else
|
|
2265 |
{
|
|
2266 |
//Check the iAllocTestStepResult
|
|
2267 |
if (allocTestStepResult != EPass)
|
|
2268 |
{
|
|
2269 |
result = ETrue;
|
|
2270 |
}
|
|
2271 |
}
|
|
2272 |
|
|
2273 |
TInt failCount = 1;
|
|
2274 |
TBool completed = EFalse;
|
|
2275 |
allocTestStepResult = EPass;
|
|
2276 |
TBool reachedEnd = EFalse;
|
|
2277 |
for(;;)
|
|
2278 |
{
|
|
2279 |
__UHEAP_SETFAIL(RHeap::EFailNext, failCount);
|
|
2280 |
__MM_HEAP_MARK;
|
|
2281 |
|
|
2282 |
//>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
2283 |
TVerdict verdict = EFail;
|
|
2284 |
TRAP(err, verdict = PerformTestL());
|
|
2285 |
if (err == KErrNone && verdict != EPass)
|
|
2286 |
{
|
|
2287 |
err = iError;
|
|
2288 |
}
|
|
2289 |
|
|
2290 |
completed = EFalse;
|
|
2291 |
if (err == KErrNone)
|
|
2292 |
{
|
|
2293 |
TAny* testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
|
|
2294 |
if (testAlloc == NULL)
|
|
2295 |
{
|
|
2296 |
reachedEnd = ETrue;
|
|
2297 |
failCount -= 1;
|
|
2298 |
}
|
|
2299 |
else
|
|
2300 |
{
|
|
2301 |
User::Free(testAlloc);
|
|
2302 |
}
|
|
2303 |
|
|
2304 |
//Check the iAllocTestStepResult
|
|
2305 |
if (allocTestStepResult != EPass)
|
|
2306 |
{
|
|
2307 |
result = ETrue;
|
|
2308 |
}
|
|
2309 |
|
|
2310 |
completed = reachedEnd || result;
|
|
2311 |
}
|
|
2312 |
else if (err != KErrNoMemory) // bad error code
|
|
2313 |
{
|
|
2314 |
completed = ETrue;
|
|
2315 |
result = EFail;
|
|
2316 |
}
|
|
2317 |
|
|
2318 |
__MM_HEAP_MARKEND;
|
|
2319 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
|
2320 |
|
|
2321 |
if (completed)
|
|
2322 |
{
|
|
2323 |
break; // exit loop
|
|
2324 |
}
|
|
2325 |
|
|
2326 |
failCount++;
|
|
2327 |
}
|
|
2328 |
|
|
2329 |
failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc
|
|
2330 |
|
|
2331 |
if (err != KErrNone || result)
|
|
2332 |
{
|
|
2333 |
allocTestStepResult = EFail;
|
|
2334 |
TBuf<80> format;
|
|
2335 |
if (result)
|
|
2336 |
{
|
|
2337 |
format.Format(_L(" Bad result with %d memory allocations tested\n"), failCount);
|
|
2338 |
}
|
|
2339 |
else
|
|
2340 |
{
|
|
2341 |
format.Format(_L(" Error(%d) with %d memory allocations tested\n"), err, failCount);
|
|
2342 |
}
|
|
2343 |
Log(format);
|
|
2344 |
}
|
|
2345 |
else
|
|
2346 |
{
|
|
2347 |
TBuf<80> format;
|
|
2348 |
format.Format(_L(" Completed OK with %d memory allocations tested\n"), failCount);
|
|
2349 |
Log(format);
|
|
2350 |
}
|
|
2351 |
|
|
2352 |
return allocTestStepResult;
|
|
2353 |
}
|
|
2354 |
|
|
2355 |
//
|
|
2356 |
// RTestVclnt2InvalidScaleFactor
|
|
2357 |
//
|
|
2358 |
RTestVclnt2InvalidScaleFactor::RTestVclnt2InvalidScaleFactor(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2359 |
: RTestVclnt2PlayFile(aTestName, aSectName, aKeyName, aExpectedError)
|
|
2360 |
{
|
|
2361 |
}
|
|
2362 |
|
|
2363 |
/**
|
|
2364 |
* RTestVclnt2InvalidScaleFactor::NewL
|
|
2365 |
*/
|
|
2366 |
RTestVclnt2InvalidScaleFactor* RTestVclnt2InvalidScaleFactor::NewL(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
|
|
2367 |
{
|
|
2368 |
RTestVclnt2InvalidScaleFactor* self = new (ELeave) RTestVclnt2InvalidScaleFactor(aTestName, aSectName, aKeyName, aExpectedError);
|
|
2369 |
return self;
|
|
2370 |
}
|
|
2371 |
|
|
2372 |
void RTestVclnt2InvalidScaleFactor::HandlePrepareCompleteL()
|
|
2373 |
{
|
|
2374 |
INFO_PRINTF1(_L("iVideoPlayer2->AddDisplayWindowL()"));
|
|
2375 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
|
2376 |
|
|
2377 |
// Try to scale the video to an invalid values
|
|
2378 |
TRAPD(err, iVideoPlayer2->SetScaleFactorL(*iWindow, 0, 100));
|
|
2379 |
if (err != KErrArgument)
|
|
2380 |
{
|
|
2381 |
User::Leave(err == KErrNone ? KErrGeneral : err);
|
|
2382 |
}
|
|
2383 |
|
|
2384 |
TRAP(err, iVideoPlayer2->SetScaleFactorL(*iWindow, 100, -100));
|
|
2385 |
if (err != KErrArgument)
|
|
2386 |
{
|
|
2387 |
User::Leave(err == KErrNone ? KErrGeneral : err);
|
|
2388 |
}
|
|
2389 |
|
|
2390 |
// trigger the video to start playing
|
|
2391 |
StartPlayback();
|
|
2392 |
}
|