sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "testvideoplayer_subtitles.h"
|
sl@0
|
17 |
|
sl@0
|
18 |
const TUint KCacheSize = 1000000; //1MB
|
sl@0
|
19 |
const TUint KMaxCacheSize = 50000000; //50MB
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
CPlayTimer* CPlayTimer::NewL(RTestVclnt2Subtitle& aTestStep)
|
sl@0
|
23 |
{
|
sl@0
|
24 |
CPlayTimer* self = new (ELeave) CPlayTimer(aTestStep);
|
sl@0
|
25 |
CleanupStack::PushL(self);
|
sl@0
|
26 |
self->ConstructL();
|
sl@0
|
27 |
CleanupStack::Pop();
|
sl@0
|
28 |
return self;
|
sl@0
|
29 |
}
|
sl@0
|
30 |
|
sl@0
|
31 |
CPlayTimer::CPlayTimer(RTestVclnt2Subtitle& aTestStep)
|
sl@0
|
32 |
: CTimer(EPriorityHigh), iTestStep(aTestStep)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
CActiveScheduler::Add(this);
|
sl@0
|
35 |
}
|
sl@0
|
36 |
|
sl@0
|
37 |
void CPlayTimer::RunL()
|
sl@0
|
38 |
{
|
sl@0
|
39 |
iTestStep.DoDuringPlaybackActionsL();
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
TInt CPlayTimer::RunError(TInt aError)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
// Tell the test to fail with error code aError.
|
sl@0
|
45 |
iTestStep.FailTest(aError);
|
sl@0
|
46 |
return KErrNone;
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
//
|
sl@0
|
50 |
// RTestVclnt2Subtitle
|
sl@0
|
51 |
//
|
sl@0
|
52 |
|
sl@0
|
53 |
RTestVclnt2Subtitle* RTestVclnt2Subtitle::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
return new (ELeave) RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
RTestVclnt2Subtitle::RTestVclnt2Subtitle(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
59 |
: RTestVclnt2AviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
void RTestVclnt2Subtitle::FailTest(TInt aError)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
ERR_PRINTF2(_L("Test step failed with error %d."), aError);
|
sl@0
|
66 |
iError = aError;
|
sl@0
|
67 |
iTestStepResult = EFail;
|
sl@0
|
68 |
CActiveScheduler::Stop();
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
TVerdict RTestVclnt2Subtitle::DoTestStepPreambleL()
|
sl@0
|
72 |
{
|
sl@0
|
73 |
User::LeaveIfError(SetCacheSize());
|
sl@0
|
74 |
TVerdict result = RTestVclnt2AviPlayerStep::DoTestStepPreambleL();
|
sl@0
|
75 |
|
sl@0
|
76 |
if (result == EPass)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
iPlayTimer = CPlayTimer::NewL(*this);
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
return result;
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
TVerdict RTestVclnt2Subtitle::DoTestStepPostambleL()
|
sl@0
|
85 |
{
|
sl@0
|
86 |
User::LeaveIfError(RevertCacheSize());
|
sl@0
|
87 |
|
sl@0
|
88 |
delete iPlayTimer;
|
sl@0
|
89 |
iPlayTimer = NULL;
|
sl@0
|
90 |
return RTestVclnt2AviPlayerStep::DoTestStepPostambleL();
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
void RTestVclnt2Subtitle::DoBeforePlaybackActionsL()
|
sl@0
|
94 |
{
|
sl@0
|
95 |
if (!iVideoPlayer2->SubtitlesAvailable())
|
sl@0
|
96 |
{
|
sl@0
|
97 |
ERR_PRINTF1(_L("SubtitlesAvailable() returned EFalse. Expected ETrue."));
|
sl@0
|
98 |
User::Leave(KErrNotSupported);
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
iVideoPlayer2->EnableSubtitlesL();
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
void RTestVclnt2Subtitle::DoDuringPlaybackActionsL()
|
sl@0
|
105 |
{
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
void RTestVclnt2Subtitle::FsmL(TVclntTestPlayEvents aEventCode)
|
sl@0
|
109 |
{
|
sl@0
|
110 |
if (FsmCheck(aEventCode))
|
sl@0
|
111 |
{
|
sl@0
|
112 |
switch (aEventCode)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
case EVPIdle:
|
sl@0
|
115 |
// Open iVideoPlayer2
|
sl@0
|
116 |
LOG_CALL(iVideoPlayer2->OpenFileL(iFilename, KMmfTestAviPlayControllerUid));
|
sl@0
|
117 |
PrepareState(EVPOpenComplete, KErrNone);
|
sl@0
|
118 |
break;
|
sl@0
|
119 |
|
sl@0
|
120 |
case EVPOpenComplete:
|
sl@0
|
121 |
// Prepare iVideoPlayer2
|
sl@0
|
122 |
LOG_CALL(iVideoPlayer2->Prepare());
|
sl@0
|
123 |
PrepareState(EVPPrepareComplete, KErrNone);
|
sl@0
|
124 |
break;
|
sl@0
|
125 |
|
sl@0
|
126 |
case EVPPrepareComplete:
|
sl@0
|
127 |
// Add display window using default values - ie. video extent & window clipping
|
sl@0
|
128 |
// defaulted to whole window.
|
sl@0
|
129 |
LOG_CALL(iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow));
|
sl@0
|
130 |
|
sl@0
|
131 |
// Perform any actions that the class or subclasses need before starting video playback.
|
sl@0
|
132 |
DoBeforePlaybackActionsL();
|
sl@0
|
133 |
|
sl@0
|
134 |
// trigger the video to start playing
|
sl@0
|
135 |
iError = KErrTimedOut;
|
sl@0
|
136 |
PrepareState(EVPPlayComplete, KErrNone);
|
sl@0
|
137 |
LOG_CALL(iVideoPlayer2->Play());
|
sl@0
|
138 |
|
sl@0
|
139 |
// Trigger a call to DoDuringPlaybackActionsL
|
sl@0
|
140 |
iPlayTimer->After(KOneSecond);
|
sl@0
|
141 |
break;
|
sl@0
|
142 |
|
sl@0
|
143 |
case EVPPlayComplete:
|
sl@0
|
144 |
iTestStepResult = EPass;
|
sl@0
|
145 |
iPlayTimer->Cancel();
|
sl@0
|
146 |
CActiveScheduler::Stop();
|
sl@0
|
147 |
break;
|
sl@0
|
148 |
}
|
sl@0
|
149 |
}
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
TInt RTestVclnt2Subtitle::SetCacheSize()
|
sl@0
|
153 |
{
|
sl@0
|
154 |
TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize);
|
sl@0
|
155 |
TInt ret=CheckCacheError(error);
|
sl@0
|
156 |
|
sl@0
|
157 |
return ret;
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
TInt RTestVclnt2Subtitle::CheckCacheError(TInt aError)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
TInt ret=KErrNone;
|
sl@0
|
163 |
#ifdef __WINSCW__
|
sl@0
|
164 |
//Winscw does not support getting cache size. Ignoring -5 error
|
sl@0
|
165 |
if(aError!=KErrNone)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
if(aError!=KErrNotSupported)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
|
sl@0
|
170 |
ret=aError;
|
sl@0
|
171 |
}
|
sl@0
|
172 |
}
|
sl@0
|
173 |
#else
|
sl@0
|
174 |
if(aError!=KErrNone)
|
sl@0
|
175 |
{//For ARMV5 we stop for all errors
|
sl@0
|
176 |
INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
|
sl@0
|
177 |
ret=aError;
|
sl@0
|
178 |
}
|
sl@0
|
179 |
#endif
|
sl@0
|
180 |
return ret;
|
sl@0
|
181 |
}
|
sl@0
|
182 |
|
sl@0
|
183 |
TInt RTestVclnt2Subtitle::RevertCacheSize()
|
sl@0
|
184 |
{
|
sl@0
|
185 |
TUint defaultCacheSize = 0;
|
sl@0
|
186 |
//Done with the test. Setting 0 makes the cache size revert back to boot up values
|
sl@0
|
187 |
TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)defaultCacheSize,(TAny*)defaultCacheSize);
|
sl@0
|
188 |
return CheckCacheError(error);
|
sl@0
|
189 |
}
|
sl@0
|
190 |
|
sl@0
|
191 |
|
sl@0
|
192 |
//
|
sl@0
|
193 |
// RTestVclnt2SubtitleEnableDuringPlayback
|
sl@0
|
194 |
//
|
sl@0
|
195 |
|
sl@0
|
196 |
RTestVclnt2SubtitleEnableDuringPlayback* RTestVclnt2SubtitleEnableDuringPlayback::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
return new (ELeave) RTestVclnt2SubtitleEnableDuringPlayback(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
199 |
}
|
sl@0
|
200 |
|
sl@0
|
201 |
RTestVclnt2SubtitleEnableDuringPlayback::RTestVclnt2SubtitleEnableDuringPlayback(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
202 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
}
|
sl@0
|
205 |
|
sl@0
|
206 |
void RTestVclnt2SubtitleEnableDuringPlayback::DoBeforePlaybackActionsL()
|
sl@0
|
207 |
{
|
sl@0
|
208 |
INFO_PRINTF1(_L("Don't enable subtitles before playback; do nothing in DoBeforePlaybackActionsL()"));
|
sl@0
|
209 |
}
|
sl@0
|
210 |
|
sl@0
|
211 |
void RTestVclnt2SubtitleEnableDuringPlayback::DoDuringPlaybackActionsL()
|
sl@0
|
212 |
{
|
sl@0
|
213 |
if (!iVideoPlayer2->SubtitlesAvailable())
|
sl@0
|
214 |
{
|
sl@0
|
215 |
ERR_PRINTF1(_L("SubtitlesAvailable() returned EFalse. Expected ETrue."));
|
sl@0
|
216 |
User::Leave(KErrNotSupported);
|
sl@0
|
217 |
}
|
sl@0
|
218 |
|
sl@0
|
219 |
iVideoPlayer2->EnableSubtitlesL();
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
//
|
sl@0
|
223 |
// RTestVclnt2SubtitleDisableDuringPlayback
|
sl@0
|
224 |
//
|
sl@0
|
225 |
|
sl@0
|
226 |
RTestVclnt2SubtitleDisableDuringPlayback* RTestVclnt2SubtitleDisableDuringPlayback::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
return new (ELeave) RTestVclnt2SubtitleDisableDuringPlayback(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
RTestVclnt2SubtitleDisableDuringPlayback::RTestVclnt2SubtitleDisableDuringPlayback(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
232 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
void RTestVclnt2SubtitleDisableDuringPlayback::DoDuringPlaybackActionsL()
|
sl@0
|
237 |
{
|
sl@0
|
238 |
iVideoPlayer2->DisableSubtitles();
|
sl@0
|
239 |
}
|
sl@0
|
240 |
|
sl@0
|
241 |
//
|
sl@0
|
242 |
// RTestVclnt2SubtitleDisableTwice
|
sl@0
|
243 |
//
|
sl@0
|
244 |
|
sl@0
|
245 |
RTestVclnt2SubtitleDisableTwice* RTestVclnt2SubtitleDisableTwice::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
246 |
{
|
sl@0
|
247 |
return new (ELeave) RTestVclnt2SubtitleDisableTwice(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
248 |
}
|
sl@0
|
249 |
|
sl@0
|
250 |
RTestVclnt2SubtitleDisableTwice::RTestVclnt2SubtitleDisableTwice(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
251 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
}
|
sl@0
|
254 |
|
sl@0
|
255 |
void RTestVclnt2SubtitleDisableTwice::DoBeforePlaybackActionsL()
|
sl@0
|
256 |
{
|
sl@0
|
257 |
iVideoPlayer2->DisableSubtitles();
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
void RTestVclnt2SubtitleDisableTwice::DoDuringPlaybackActionsL()
|
sl@0
|
261 |
{
|
sl@0
|
262 |
iVideoPlayer2->DisableSubtitles();
|
sl@0
|
263 |
}
|
sl@0
|
264 |
|
sl@0
|
265 |
//
|
sl@0
|
266 |
// RTestVclnt2SubtitleWindowClipBefore
|
sl@0
|
267 |
//
|
sl@0
|
268 |
|
sl@0
|
269 |
RTestVclnt2SubtitleWindowClipBefore* RTestVclnt2SubtitleWindowClipBefore::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
return new (ELeave) RTestVclnt2SubtitleWindowClipBefore(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
272 |
}
|
sl@0
|
273 |
|
sl@0
|
274 |
RTestVclnt2SubtitleWindowClipBefore::RTestVclnt2SubtitleWindowClipBefore(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
275 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
276 |
{
|
sl@0
|
277 |
}
|
sl@0
|
278 |
|
sl@0
|
279 |
void RTestVclnt2SubtitleWindowClipBefore::DoBeforePlaybackActionsL()
|
sl@0
|
280 |
{
|
sl@0
|
281 |
RTestVclnt2Subtitle::DoBeforePlaybackActionsL();
|
sl@0
|
282 |
|
sl@0
|
283 |
TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
|
sl@0
|
284 |
|
sl@0
|
285 |
// shrink the window clipping rect by half the height & width
|
sl@0
|
286 |
iVideoPlayer2->SetWindowClipRectL(*iWindow, TRect(windowSize));
|
sl@0
|
287 |
}
|
sl@0
|
288 |
|
sl@0
|
289 |
//
|
sl@0
|
290 |
// RTestVclnt2SubtitleWindowClipDuring
|
sl@0
|
291 |
//
|
sl@0
|
292 |
|
sl@0
|
293 |
RTestVclnt2SubtitleWindowClipDuring* RTestVclnt2SubtitleWindowClipDuring::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
294 |
{
|
sl@0
|
295 |
return new (ELeave) RTestVclnt2SubtitleWindowClipDuring(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
RTestVclnt2SubtitleWindowClipDuring::RTestVclnt2SubtitleWindowClipDuring(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
299 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
300 |
{
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
void RTestVclnt2SubtitleWindowClipDuring::DoDuringPlaybackActionsL()
|
sl@0
|
304 |
{
|
sl@0
|
305 |
TSize windowSize(iWindow->Size().iWidth / 2, iWindow->Size().iHeight / 2);
|
sl@0
|
306 |
|
sl@0
|
307 |
// shrink the window clipping rect by half the height & width
|
sl@0
|
308 |
iVideoPlayer2->SetWindowClipRectL(*iWindow, TRect(windowSize));
|
sl@0
|
309 |
}
|
sl@0
|
310 |
|
sl@0
|
311 |
//
|
sl@0
|
312 |
// RTestVclnt2SubtitleRotateBefore
|
sl@0
|
313 |
//
|
sl@0
|
314 |
|
sl@0
|
315 |
RTestVclnt2SubtitleRotateBefore* RTestVclnt2SubtitleRotateBefore::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
316 |
{
|
sl@0
|
317 |
return new (ELeave) RTestVclnt2SubtitleRotateBefore(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
318 |
}
|
sl@0
|
319 |
|
sl@0
|
320 |
RTestVclnt2SubtitleRotateBefore::RTestVclnt2SubtitleRotateBefore(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
321 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
}
|
sl@0
|
324 |
|
sl@0
|
325 |
void RTestVclnt2SubtitleRotateBefore::DoBeforePlaybackActionsL()
|
sl@0
|
326 |
{
|
sl@0
|
327 |
RTestVclnt2Subtitle::DoBeforePlaybackActionsL();
|
sl@0
|
328 |
iVideoPlayer2->SetRotationL(*iWindow, EVideoRotationClockwise180);
|
sl@0
|
329 |
}
|
sl@0
|
330 |
|
sl@0
|
331 |
//
|
sl@0
|
332 |
// RTestVclnt2SubtitleRotateDuring
|
sl@0
|
333 |
//
|
sl@0
|
334 |
|
sl@0
|
335 |
RTestVclnt2SubtitleRotateDuring* RTestVclnt2SubtitleRotateDuring::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
336 |
{
|
sl@0
|
337 |
return new (ELeave) RTestVclnt2SubtitleRotateDuring(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
338 |
}
|
sl@0
|
339 |
|
sl@0
|
340 |
RTestVclnt2SubtitleRotateDuring::RTestVclnt2SubtitleRotateDuring(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
341 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
342 |
{
|
sl@0
|
343 |
}
|
sl@0
|
344 |
|
sl@0
|
345 |
void RTestVclnt2SubtitleRotateDuring::DoDuringPlaybackActionsL()
|
sl@0
|
346 |
{
|
sl@0
|
347 |
iVideoPlayer2->SetRotationL(*iWindow, EVideoRotationClockwise180);
|
sl@0
|
348 |
}
|
sl@0
|
349 |
|
sl@0
|
350 |
//
|
sl@0
|
351 |
// RTestVclnt2SubtitleRemoveDisplayDuring
|
sl@0
|
352 |
//
|
sl@0
|
353 |
|
sl@0
|
354 |
RTestVclnt2SubtitleRemoveDisplayDuring* RTestVclnt2SubtitleRemoveDisplayDuring::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
355 |
{
|
sl@0
|
356 |
return new (ELeave) RTestVclnt2SubtitleRemoveDisplayDuring(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
RTestVclnt2SubtitleRemoveDisplayDuring::RTestVclnt2SubtitleRemoveDisplayDuring(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
360 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
}
|
sl@0
|
363 |
|
sl@0
|
364 |
void RTestVclnt2SubtitleRemoveDisplayDuring::DoDuringPlaybackActionsL()
|
sl@0
|
365 |
{
|
sl@0
|
366 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
sl@0
|
367 |
iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iWindow);
|
sl@0
|
368 |
}
|
sl@0
|
369 |
|
sl@0
|
370 |
//
|
sl@0
|
371 |
// RTestVclnt2SubtitleNotAvailable
|
sl@0
|
372 |
//
|
sl@0
|
373 |
|
sl@0
|
374 |
RTestVclnt2SubtitleNotAvailable* RTestVclnt2SubtitleNotAvailable::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
375 |
{
|
sl@0
|
376 |
return new (ELeave) RTestVclnt2SubtitleNotAvailable(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
377 |
}
|
sl@0
|
378 |
|
sl@0
|
379 |
RTestVclnt2SubtitleNotAvailable::RTestVclnt2SubtitleNotAvailable(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
380 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
381 |
{
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
void RTestVclnt2SubtitleNotAvailable::DoBeforePlaybackActionsL()
|
sl@0
|
385 |
{
|
sl@0
|
386 |
if (iVideoPlayer2->SubtitlesAvailable())
|
sl@0
|
387 |
{
|
sl@0
|
388 |
ERR_PRINTF1(_L("SubtitlesAvailable() returned ETrue. Expected EFalse."));
|
sl@0
|
389 |
User::Leave(KErrGeneral);
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
TRAPD(err, iVideoPlayer2->EnableSubtitlesL());
|
sl@0
|
393 |
|
sl@0
|
394 |
if (KErrNotFound != err)
|
sl@0
|
395 |
{
|
sl@0
|
396 |
ERR_PRINTF3(_L("EnableSubtitlesL() left with %d. Expected %d."), err, KErrNotFound);
|
sl@0
|
397 |
User::Leave(KErrGeneral);
|
sl@0
|
398 |
}
|
sl@0
|
399 |
}
|
sl@0
|
400 |
|
sl@0
|
401 |
//
|
sl@0
|
402 |
// RTestVclnt2SubtitleLanguage
|
sl@0
|
403 |
//
|
sl@0
|
404 |
|
sl@0
|
405 |
RTestVclnt2SubtitleLanguage* RTestVclnt2SubtitleLanguage::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
406 |
{
|
sl@0
|
407 |
return new (ELeave) RTestVclnt2SubtitleLanguage(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
408 |
}
|
sl@0
|
409 |
|
sl@0
|
410 |
RTestVclnt2SubtitleLanguage::RTestVclnt2SubtitleLanguage(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
411 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
412 |
{
|
sl@0
|
413 |
}
|
sl@0
|
414 |
|
sl@0
|
415 |
void RTestVclnt2SubtitleLanguage::DoBeforePlaybackActionsL()
|
sl@0
|
416 |
{
|
sl@0
|
417 |
RTestVclnt2Subtitle::DoBeforePlaybackActionsL();
|
sl@0
|
418 |
|
sl@0
|
419 |
TLanguage lang = ELangNone;
|
sl@0
|
420 |
TRAPD(err, lang = iVideoPlayer2->SubtitleLanguageL());
|
sl@0
|
421 |
if (KErrNone != err)
|
sl@0
|
422 |
{
|
sl@0
|
423 |
ERR_PRINTF3(_L("SubtitleLanguageL() left with %d. Expected %d."), err, KErrNone);
|
sl@0
|
424 |
User::Leave(err);
|
sl@0
|
425 |
}
|
sl@0
|
426 |
else if (ELangNone != lang)
|
sl@0
|
427 |
{
|
sl@0
|
428 |
// Languages are not supported; ELangNone should be returned.
|
sl@0
|
429 |
ERR_PRINTF3(_L("SubtitleLanguageL() returned %d. Expected %d."), lang, ELangNone);
|
sl@0
|
430 |
User::Leave(KErrGeneral);
|
sl@0
|
431 |
}
|
sl@0
|
432 |
|
sl@0
|
433 |
TInt count = -1;
|
sl@0
|
434 |
TRAP(err, count = iVideoPlayer2->SupportedSubtitleLanguagesL().Count());
|
sl@0
|
435 |
if (KErrNone != err)
|
sl@0
|
436 |
{
|
sl@0
|
437 |
ERR_PRINTF3(_L("SupportedSubtitleLanguagesL() left with %d. Expected %d."), err, KErrNone);
|
sl@0
|
438 |
User::Leave(KErrGeneral);
|
sl@0
|
439 |
}
|
sl@0
|
440 |
if (count != 0)
|
sl@0
|
441 |
{
|
sl@0
|
442 |
ERR_PRINTF1(_L("SupportedSubtitleLanguagesL() returned a non-empty array"));
|
sl@0
|
443 |
User::Leave(KErrGeneral);
|
sl@0
|
444 |
}
|
sl@0
|
445 |
|
sl@0
|
446 |
TRAP(err, iVideoPlayer2->SetSubtitleLanguageL(lang));
|
sl@0
|
447 |
|
sl@0
|
448 |
if (KErrNotSupported != err)
|
sl@0
|
449 |
{
|
sl@0
|
450 |
ERR_PRINTF3(_L("SetSubtitleLanguageL() left with %d. Expected %d."), err, KErrNone);
|
sl@0
|
451 |
User::Leave(KErrGeneral);
|
sl@0
|
452 |
}
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
//
|
sl@0
|
456 |
// RTestVclnt2SubtitleRedraw
|
sl@0
|
457 |
//
|
sl@0
|
458 |
|
sl@0
|
459 |
RTestVclnt2SubtitleRedraw* RTestVclnt2SubtitleRedraw::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, TBool aEnableSubtitles)
|
sl@0
|
460 |
{
|
sl@0
|
461 |
return new (ELeave) RTestVclnt2SubtitleRedraw(aTestName, aSectName, aKeyName, aExpectedError, aEnableSubtitles);
|
sl@0
|
462 |
}
|
sl@0
|
463 |
|
sl@0
|
464 |
RTestVclnt2SubtitleRedraw::RTestVclnt2SubtitleRedraw(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, TBool aEnableSubtitles)
|
sl@0
|
465 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError), iEnableSubtitles(aEnableSubtitles)
|
sl@0
|
466 |
{
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
void RTestVclnt2SubtitleRedraw::DoBeforePlaybackActionsL()
|
sl@0
|
470 |
{
|
sl@0
|
471 |
if (iEnableSubtitles)
|
sl@0
|
472 |
{
|
sl@0
|
473 |
// The parent class will enable subtitle support
|
sl@0
|
474 |
RTestVclnt2Subtitle::DoBeforePlaybackActionsL();
|
sl@0
|
475 |
}
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
void RTestVclnt2SubtitleRedraw::DoDuringPlaybackActionsL()
|
sl@0
|
479 |
{
|
sl@0
|
480 |
// Redraw the whole subtitle
|
sl@0
|
481 |
iWindow->Invalidate();
|
sl@0
|
482 |
LOG_CALL(iVideoPlayer2->RedrawSubtitle(*iWindow, TRect(iWindow->Size())));
|
sl@0
|
483 |
}
|
sl@0
|
484 |
|
sl@0
|
485 |
//
|
sl@0
|
486 |
// RTestVclnt2SubtitleRotateClipRedraw
|
sl@0
|
487 |
//
|
sl@0
|
488 |
|
sl@0
|
489 |
RTestVclnt2SubtitleRotateClipRedraw* RTestVclnt2SubtitleRotateClipRedraw::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
490 |
{
|
sl@0
|
491 |
return new (ELeave) RTestVclnt2SubtitleRotateClipRedraw(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
492 |
}
|
sl@0
|
493 |
|
sl@0
|
494 |
RTestVclnt2SubtitleRotateClipRedraw::RTestVclnt2SubtitleRotateClipRedraw(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
495 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
496 |
{
|
sl@0
|
497 |
}
|
sl@0
|
498 |
|
sl@0
|
499 |
void RTestVclnt2SubtitleRotateClipRedraw::DoBeforePlaybackActionsL()
|
sl@0
|
500 |
{
|
sl@0
|
501 |
RTestVclnt2Subtitle::DoBeforePlaybackActionsL();
|
sl@0
|
502 |
|
sl@0
|
503 |
iVideoPlayer2->SetRotationL(*iWindow, EVideoRotationClockwise90);
|
sl@0
|
504 |
|
sl@0
|
505 |
// shrink the window clipping rect by half the height & width
|
sl@0
|
506 |
TSize windowSize(iWindow->Size().iWidth / 3, iWindow->Size().iHeight / 2);
|
sl@0
|
507 |
iVideoPlayer2->SetWindowClipRectL(*iWindow, TRect(windowSize));
|
sl@0
|
508 |
}
|
sl@0
|
509 |
|
sl@0
|
510 |
void RTestVclnt2SubtitleRotateClipRedraw::DoDuringPlaybackActionsL()
|
sl@0
|
511 |
{
|
sl@0
|
512 |
// Redraw the whole subtitle
|
sl@0
|
513 |
iWindow->Invalidate();
|
sl@0
|
514 |
iVideoPlayer2->RedrawSubtitle(*iWindow, TRect(iWindow->Size()));
|
sl@0
|
515 |
}
|
sl@0
|
516 |
|
sl@0
|
517 |
//
|
sl@0
|
518 |
// RTestVclnt2SubtitleMultipleWindows
|
sl@0
|
519 |
//
|
sl@0
|
520 |
|
sl@0
|
521 |
RTestVclnt2SubtitleMultipleWindows* RTestVclnt2SubtitleMultipleWindows::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
522 |
{
|
sl@0
|
523 |
return new (ELeave) RTestVclnt2SubtitleMultipleWindows(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
524 |
}
|
sl@0
|
525 |
|
sl@0
|
526 |
RTestVclnt2SubtitleMultipleWindows::RTestVclnt2SubtitleMultipleWindows(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
527 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
528 |
{
|
sl@0
|
529 |
}
|
sl@0
|
530 |
|
sl@0
|
531 |
TVerdict RTestVclnt2SubtitleMultipleWindows::DoTestStepPreambleL()
|
sl@0
|
532 |
{
|
sl@0
|
533 |
TVerdict result = RTestVclnt2Subtitle::DoTestStepPreambleL();
|
sl@0
|
534 |
|
sl@0
|
535 |
if (result != EPass)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
return result;
|
sl@0
|
538 |
}
|
sl@0
|
539 |
|
sl@0
|
540 |
iSecondaryWin = new(ELeave) RWindow(iWs);
|
sl@0
|
541 |
|
sl@0
|
542 |
// Construct an RWindow with a unique id. Use this pointer to get a unique number.
|
sl@0
|
543 |
User::LeaveIfError(iSecondaryWin->Construct(iRootWindow, ((TInt) this) + 3));
|
sl@0
|
544 |
iSecondaryWin->SetRequiredDisplayMode(EColor16MA);
|
sl@0
|
545 |
iSecondaryWin->SetExtent(TPoint(0,0), TSize(100,100));
|
sl@0
|
546 |
iSecondaryWin->SetVisible(ETrue);
|
sl@0
|
547 |
iSecondaryWin->SetBackgroundColor(TRgb(0, 0));
|
sl@0
|
548 |
iSecondaryWin->Activate();
|
sl@0
|
549 |
iSecondaryWin->BeginRedraw();
|
sl@0
|
550 |
iSecondaryWin->EndRedraw();
|
sl@0
|
551 |
iWs.Flush();
|
sl@0
|
552 |
|
sl@0
|
553 |
return EPass;
|
sl@0
|
554 |
}
|
sl@0
|
555 |
|
sl@0
|
556 |
TVerdict RTestVclnt2SubtitleMultipleWindows::DoTestStepPostambleL()
|
sl@0
|
557 |
{
|
sl@0
|
558 |
|
sl@0
|
559 |
delete iVideoPlayer2;
|
sl@0
|
560 |
iVideoPlayer2 = NULL;
|
sl@0
|
561 |
|
sl@0
|
562 |
iSecondaryWin->Close();
|
sl@0
|
563 |
delete iSecondaryWin;
|
sl@0
|
564 |
iSecondaryWin = NULL;
|
sl@0
|
565 |
|
sl@0
|
566 |
// Base DoTestStepPostambleL
|
sl@0
|
567 |
return RTestVclnt2Subtitle::DoTestStepPostambleL();
|
sl@0
|
568 |
}
|
sl@0
|
569 |
|
sl@0
|
570 |
void RTestVclnt2SubtitleMultipleWindows::DoBeforePlaybackActionsL()
|
sl@0
|
571 |
{
|
sl@0
|
572 |
TRAPD(err, iVideoPlayer2->AddDisplayWindowL(iWs, *iScreen, *iSecondaryWin));
|
sl@0
|
573 |
|
sl@0
|
574 |
if (err != KErrNone)
|
sl@0
|
575 |
{
|
sl@0
|
576 |
ERR_PRINTF3(_L("Adding second display window with AddDisplayWindowL() left with %d. Expected %d."), err, KErrNone);
|
sl@0
|
577 |
User::Leave(err);
|
sl@0
|
578 |
}
|
sl@0
|
579 |
|
sl@0
|
580 |
RTestVclnt2Subtitle::DoBeforePlaybackActionsL();
|
sl@0
|
581 |
}
|
sl@0
|
582 |
|
sl@0
|
583 |
//
|
sl@0
|
584 |
// RTestVclnt2SubtitleEnableTwice
|
sl@0
|
585 |
//
|
sl@0
|
586 |
|
sl@0
|
587 |
RTestVclnt2SubtitleEnableTwice* RTestVclnt2SubtitleEnableTwice::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
588 |
{
|
sl@0
|
589 |
return new (ELeave) RTestVclnt2SubtitleEnableTwice(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
590 |
}
|
sl@0
|
591 |
|
sl@0
|
592 |
RTestVclnt2SubtitleEnableTwice::RTestVclnt2SubtitleEnableTwice(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
593 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
594 |
{
|
sl@0
|
595 |
}
|
sl@0
|
596 |
|
sl@0
|
597 |
void RTestVclnt2SubtitleEnableTwice::DoBeforePlaybackActionsL()
|
sl@0
|
598 |
{
|
sl@0
|
599 |
RTestVclnt2Subtitle::DoBeforePlaybackActionsL();
|
sl@0
|
600 |
|
sl@0
|
601 |
// Enable subtitles again
|
sl@0
|
602 |
TRAPD(err, iVideoPlayer2->EnableSubtitlesL());
|
sl@0
|
603 |
|
sl@0
|
604 |
if (KErrInUse != err)
|
sl@0
|
605 |
{
|
sl@0
|
606 |
ERR_PRINTF3(_L("Calling EnableSubtitlesL twice left with %d. Expected %d."), err, KErrInUse);
|
sl@0
|
607 |
// Leave with KErrGeneral if err is no error. Otherwise leave with err.
|
sl@0
|
608 |
User::Leave(KErrNone == err ? KErrGeneral : err);
|
sl@0
|
609 |
}
|
sl@0
|
610 |
}
|
sl@0
|
611 |
|
sl@0
|
612 |
//
|
sl@0
|
613 |
// RTestVclnt2SubtitleEnableDisableStress
|
sl@0
|
614 |
//
|
sl@0
|
615 |
|
sl@0
|
616 |
RTestVclnt2SubtitleEnableDisableStress* RTestVclnt2SubtitleEnableDisableStress::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
617 |
{
|
sl@0
|
618 |
return new (ELeave) RTestVclnt2SubtitleEnableDisableStress(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
619 |
}
|
sl@0
|
620 |
|
sl@0
|
621 |
RTestVclnt2SubtitleEnableDisableStress::RTestVclnt2SubtitleEnableDisableStress(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
622 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
623 |
{
|
sl@0
|
624 |
// Expect subtitles to be available if this is not being run with "subtitlesUnavailable" file.
|
sl@0
|
625 |
iExpectAvailable = (aKeyName != _L("subtitleUnavailable"));
|
sl@0
|
626 |
}
|
sl@0
|
627 |
|
sl@0
|
628 |
void RTestVclnt2SubtitleEnableDisableStress::DoBeforePlaybackActionsL()
|
sl@0
|
629 |
{
|
sl@0
|
630 |
TBool subtitlesAvail = iVideoPlayer2->SubtitlesAvailable();
|
sl@0
|
631 |
|
sl@0
|
632 |
if (iExpectAvailable != subtitlesAvail)
|
sl@0
|
633 |
{
|
sl@0
|
634 |
ERR_PRINTF1(_L("SubtitlesAvailable() gave unexpected result"));
|
sl@0
|
635 |
User::Leave(KErrGeneral);
|
sl@0
|
636 |
}
|
sl@0
|
637 |
|
sl@0
|
638 |
if (subtitlesAvail)
|
sl@0
|
639 |
{
|
sl@0
|
640 |
INFO_PRINTF1(_L("Enabling subtitles"));
|
sl@0
|
641 |
iVideoPlayer2->EnableSubtitlesL();
|
sl@0
|
642 |
}
|
sl@0
|
643 |
else
|
sl@0
|
644 |
{
|
sl@0
|
645 |
INFO_PRINTF1(_L("Subtitles not available"));
|
sl@0
|
646 |
}
|
sl@0
|
647 |
|
sl@0
|
648 |
iDisableNext = ETrue;
|
sl@0
|
649 |
}
|
sl@0
|
650 |
|
sl@0
|
651 |
void RTestVclnt2SubtitleEnableDisableStress::DoDuringPlaybackActionsL()
|
sl@0
|
652 |
{
|
sl@0
|
653 |
TBool subtitlesAvail = iVideoPlayer2->SubtitlesAvailable();
|
sl@0
|
654 |
|
sl@0
|
655 |
if (iExpectAvailable != subtitlesAvail)
|
sl@0
|
656 |
{
|
sl@0
|
657 |
ERR_PRINTF1(_L("SubtitlesAvailable() gave unexpected result"));
|
sl@0
|
658 |
User::Leave(KErrGeneral);
|
sl@0
|
659 |
}
|
sl@0
|
660 |
|
sl@0
|
661 |
if (iDisableNext)
|
sl@0
|
662 |
{
|
sl@0
|
663 |
INFO_PRINTF1(_L("Disabling subtitles"));
|
sl@0
|
664 |
iVideoPlayer2->DisableSubtitles();
|
sl@0
|
665 |
}
|
sl@0
|
666 |
else if (subtitlesAvail)
|
sl@0
|
667 |
{
|
sl@0
|
668 |
INFO_PRINTF1(_L("Enabling subtitles"));
|
sl@0
|
669 |
iVideoPlayer2->EnableSubtitlesL();
|
sl@0
|
670 |
}
|
sl@0
|
671 |
else
|
sl@0
|
672 |
{
|
sl@0
|
673 |
INFO_PRINTF1(_L("Subtitles not available... cannot enable"));
|
sl@0
|
674 |
}
|
sl@0
|
675 |
|
sl@0
|
676 |
iDisableNext = !iDisableNext;
|
sl@0
|
677 |
iPlayTimer->After(KOneSecond / 4);
|
sl@0
|
678 |
}
|
sl@0
|
679 |
|
sl@0
|
680 |
//
|
sl@0
|
681 |
// RTestVclnt2SubtitleAlloc
|
sl@0
|
682 |
//
|
sl@0
|
683 |
|
sl@0
|
684 |
RTestVclnt2SubtitleAlloc* RTestVclnt2SubtitleAlloc::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
685 |
{
|
sl@0
|
686 |
return new (ELeave) RTestVclnt2SubtitleAlloc(aTestName, aSectName, aKeyName, aExpectedError);
|
sl@0
|
687 |
}
|
sl@0
|
688 |
|
sl@0
|
689 |
RTestVclnt2SubtitleAlloc::RTestVclnt2SubtitleAlloc(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
|
sl@0
|
690 |
: RTestVclnt2Subtitle(aTestName, aSectName, aKeyName, aExpectedError)
|
sl@0
|
691 |
{
|
sl@0
|
692 |
}
|
sl@0
|
693 |
|
sl@0
|
694 |
TVerdict RTestVclnt2SubtitleAlloc::DoTestStepPreambleL()
|
sl@0
|
695 |
{
|
sl@0
|
696 |
// Don't do the normal initialization here. It will be done before each alloc test iteration.
|
sl@0
|
697 |
return EPass;
|
sl@0
|
698 |
}
|
sl@0
|
699 |
|
sl@0
|
700 |
TVerdict RTestVclnt2SubtitleAlloc::DoTestStepPostambleL()
|
sl@0
|
701 |
{
|
sl@0
|
702 |
// Don't do the normal cleanup here. It will be done after each alloc test iteration.
|
sl@0
|
703 |
return EPass;
|
sl@0
|
704 |
}
|
sl@0
|
705 |
|
sl@0
|
706 |
TVerdict RTestVclnt2SubtitleAlloc::PerformTestL()
|
sl@0
|
707 |
{
|
sl@0
|
708 |
TVerdict result = EFail;
|
sl@0
|
709 |
TRAPD(err, result = RTestVclnt2Subtitle::DoTestStepPreambleL());
|
sl@0
|
710 |
if (iError != KErrNone)
|
sl@0
|
711 |
{
|
sl@0
|
712 |
err = iError;
|
sl@0
|
713 |
}
|
sl@0
|
714 |
|
sl@0
|
715 |
if (err == KErrNone && result == EPass && iError == KErrNone)
|
sl@0
|
716 |
{
|
sl@0
|
717 |
TRAP(err, result = RTestVclnt2AviPlayerStep::DoTestStepL());
|
sl@0
|
718 |
|
sl@0
|
719 |
if (iError != KErrNone)
|
sl@0
|
720 |
{
|
sl@0
|
721 |
err = iError;
|
sl@0
|
722 |
}
|
sl@0
|
723 |
}
|
sl@0
|
724 |
|
sl@0
|
725 |
// Call postable function, but don't overwrite verdict from previous test call results.
|
sl@0
|
726 |
TVerdict postResult = RTestVclnt2Subtitle::DoTestStepPostambleL();
|
sl@0
|
727 |
|
sl@0
|
728 |
if (iError != KErrNone)
|
sl@0
|
729 |
{
|
sl@0
|
730 |
err = iError;
|
sl@0
|
731 |
}
|
sl@0
|
732 |
|
sl@0
|
733 |
User::LeaveIfError(err);
|
sl@0
|
734 |
if (EPass != result)
|
sl@0
|
735 |
{
|
sl@0
|
736 |
return result;
|
sl@0
|
737 |
}
|
sl@0
|
738 |
if (EPass != postResult)
|
sl@0
|
739 |
{
|
sl@0
|
740 |
return postResult;
|
sl@0
|
741 |
}
|
sl@0
|
742 |
|
sl@0
|
743 |
return EPass;
|
sl@0
|
744 |
}
|
sl@0
|
745 |
|
sl@0
|
746 |
TVerdict RTestVclnt2SubtitleAlloc::DoTestStepL()
|
sl@0
|
747 |
{
|
sl@0
|
748 |
TVerdict allocTestResult = EFail;
|
sl@0
|
749 |
TVerdict result = EFail;
|
sl@0
|
750 |
|
sl@0
|
751 |
TRAPD(err, result = PerformTestL());
|
sl@0
|
752 |
|
sl@0
|
753 |
if (err != KErrNone || result != EPass)
|
sl@0
|
754 |
{
|
sl@0
|
755 |
ERR_PRINTF1(_L("Failed to run test iteration without setting heap allocation failure flag"));
|
sl@0
|
756 |
return allocTestResult;
|
sl@0
|
757 |
}
|
sl@0
|
758 |
|
sl@0
|
759 |
TBool completed = EFalse;
|
sl@0
|
760 |
|
sl@0
|
761 |
for (TInt rate = 1; !completed; rate++)
|
sl@0
|
762 |
{
|
sl@0
|
763 |
__UHEAP_SETFAIL(RHeap::EFailNext, rate);
|
sl@0
|
764 |
__MM_HEAP_MARK;
|
sl@0
|
765 |
|
sl@0
|
766 |
result = EFail;
|
sl@0
|
767 |
TRAPD(err, result = PerformTestL());
|
sl@0
|
768 |
|
sl@0
|
769 |
INFO_PRINTF3(_L("Iteration %d. Alloc failed %d times"), rate, __UHEAP_CHECKFAILURE);
|
sl@0
|
770 |
|
sl@0
|
771 |
if (__UHEAP_CHECKFAILURE == 0)
|
sl@0
|
772 |
{
|
sl@0
|
773 |
// Heap did not fail. Test should have passed with no errors.
|
sl@0
|
774 |
if (KErrNone != result)
|
sl@0
|
775 |
{
|
sl@0
|
776 |
ERR_PRINTF2(_L("Failed on iteration %d. Test failed when no heap allocation failed"), rate);
|
sl@0
|
777 |
allocTestResult = EFail;
|
sl@0
|
778 |
}
|
sl@0
|
779 |
else
|
sl@0
|
780 |
{
|
sl@0
|
781 |
INFO_PRINTF2(_L("Passed on iteration %d."), rate);
|
sl@0
|
782 |
allocTestResult = EPass;
|
sl@0
|
783 |
}
|
sl@0
|
784 |
|
sl@0
|
785 |
completed = ETrue; // Finished iterating the test
|
sl@0
|
786 |
}
|
sl@0
|
787 |
else if ((err == KErrNone && result == EPass) || (err == KErrNoMemory))
|
sl@0
|
788 |
{
|
sl@0
|
789 |
// Continue with next iteration if (a) alloc fail was handled and no error and a pass or
|
sl@0
|
790 |
// (b) we got an out of memory error.
|
sl@0
|
791 |
INFO_PRINTF3(_L("Iteration result is %d, error is %d. Starting next iteration"), result, err);
|
sl@0
|
792 |
}
|
sl@0
|
793 |
else
|
sl@0
|
794 |
{
|
sl@0
|
795 |
ERR_PRINTF4(_L("Failed on iteration %d. Test failed with error %d. Expected %d."), rate, err, KErrNoMemory);
|
sl@0
|
796 |
completed = ETrue;
|
sl@0
|
797 |
allocTestResult = EFail;
|
sl@0
|
798 |
}
|
sl@0
|
799 |
|
sl@0
|
800 |
__MM_HEAP_MARKEND;
|
sl@0
|
801 |
}
|
sl@0
|
802 |
|
sl@0
|
803 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
sl@0
|
804 |
|
sl@0
|
805 |
return allocTestResult;
|
sl@0
|
806 |
}
|