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 "teststepvclnt2crp.h"
|
sl@0
|
17 |
#include <graphics/surfaceconfiguration.h>
|
sl@0
|
18 |
|
sl@0
|
19 |
const TInt KScreenNumber = 0;
|
sl@0
|
20 |
|
sl@0
|
21 |
_LIT(KUseCRP, "UseCRP");
|
sl@0
|
22 |
_LIT(KAddDisplay, "AddDisplay");
|
sl@0
|
23 |
_LIT(KAddWindow, "AddWindow");
|
sl@0
|
24 |
_LIT(Kfilename, "filename");
|
sl@0
|
25 |
|
sl@0
|
26 |
RTestStepVclnt2CRP* RTestStepVclnt2CRP::NewL(const TDesC& aName)
|
sl@0
|
27 |
{
|
sl@0
|
28 |
RTestStepVclnt2CRP* self = new (ELeave) RTestStepVclnt2CRP(aName);
|
sl@0
|
29 |
return self;
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
RTestStepVclnt2CRP::RTestStepVclnt2CRP(const TDesC& aName) :
|
sl@0
|
33 |
RTestVclnt2PlayFile(aName, aName, Kfilename, KErrNone)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
}
|
sl@0
|
36 |
|
sl@0
|
37 |
RTestStepVclnt2CRP::~RTestStepVclnt2CRP()
|
sl@0
|
38 |
{
|
sl@0
|
39 |
if (iSurfaceWindow)
|
sl@0
|
40 |
{
|
sl@0
|
41 |
iSurfaceWindow->Close();
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
delete iSurfaceWindow;
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
TVerdict RTestStepVclnt2CRP::DoTestStepPreambleL()
|
sl@0
|
48 |
{
|
sl@0
|
49 |
iTestStepResult = RTestVclnt2PlayFile::DoTestStepPreambleL();
|
sl@0
|
50 |
|
sl@0
|
51 |
if (iTestStepResult == EPass)
|
sl@0
|
52 |
{
|
sl@0
|
53 |
iTestStepResult = EFail;
|
sl@0
|
54 |
// Assume if values are not set to revert to defaults
|
sl@0
|
55 |
// e.g. EFalse default
|
sl@0
|
56 |
GetBoolFromConfig(iTestStepName, KUseCRP, iUseCRP);
|
sl@0
|
57 |
// EFalse default
|
sl@0
|
58 |
GetBoolFromConfig(iTestStepName, KAddDisplay, iAddDisplay);
|
sl@0
|
59 |
// EFalse default
|
sl@0
|
60 |
GetBoolFromConfig(iTestStepName, KAddWindow, iAddWindow);
|
sl@0
|
61 |
|
sl@0
|
62 |
iSurfaceWindow = new (ELeave) RWindow(iWs);
|
sl@0
|
63 |
// Don't use this but instead something 'unique' since this is used in the base class to
|
sl@0
|
64 |
// construct a window
|
sl@0
|
65 |
User::LeaveIfError(iSurfaceWindow->Construct(*iWindow, reinterpret_cast<TInt>(this + 3431)));
|
sl@0
|
66 |
iTestStepResult = EPass;
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
return iTestStepResult;
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
TVerdict RTestStepVclnt2CRP::DoTestStepPostambleL()
|
sl@0
|
73 |
{
|
sl@0
|
74 |
if (iSurfaceWindow)
|
sl@0
|
75 |
{
|
sl@0
|
76 |
iSurfaceWindow->Close();
|
sl@0
|
77 |
iSurfaceWindow = NULL;
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
return RTestVclnt2PlayFile::DoTestStepPostambleL();
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
void RTestStepVclnt2CRP::HandleOpenCompleteL()
|
sl@0
|
84 |
{
|
sl@0
|
85 |
if (!iAddWindow)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
iVideoPlayer2->RemoveDisplayWindow(*iWindow);
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
if (iAddDisplay)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
iVideoPlayer2->AddDisplayL(iWs, KScreenNumber, *this);
|
sl@0
|
93 |
}
|
sl@0
|
94 |
|
sl@0
|
95 |
RTestVclnt2PlayFile::HandleOpenCompleteL();
|
sl@0
|
96 |
}
|
sl@0
|
97 |
|
sl@0
|
98 |
void RTestStepVclnt2CRP::MmsehSurfaceCreated(TInt aDisplayId, const TSurfaceId& aId, const TRect& aCropRect, TVideoAspectRatio /*aAspectRatio*/)
|
sl@0
|
99 |
{
|
sl@0
|
100 |
if (aDisplayId != KScreenNumber)
|
sl@0
|
101 |
{
|
sl@0
|
102 |
FailTest(_L("Mismatching display id provided to MmsehSurfaceCreated"));
|
sl@0
|
103 |
return;
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
iSurfaceId = aId;
|
sl@0
|
107 |
iCropRect = aCropRect;
|
sl@0
|
108 |
|
sl@0
|
109 |
const TRect windowSize(iSurfaceWindow->Size());
|
sl@0
|
110 |
|
sl@0
|
111 |
TSurfaceConfiguration config;
|
sl@0
|
112 |
config.SetSurfaceId(iSurfaceId);
|
sl@0
|
113 |
config.SetExtent(windowSize);
|
sl@0
|
114 |
config.SetViewport(iCropRect);
|
sl@0
|
115 |
|
sl@0
|
116 |
iSurfaceWindow->SetVisible(ETrue);
|
sl@0
|
117 |
iSurfaceWindow->SetBackgroundColor(TRgb(0, 0));
|
sl@0
|
118 |
|
sl@0
|
119 |
TRAP_IGNORE(iVideoPlayer2->SetRotationL(*iWindow, EVideoRotationClockwise90));
|
sl@0
|
120 |
TRAP_IGNORE(iVideoPlayer2->RotationL(*iWindow));
|
sl@0
|
121 |
TRAP_IGNORE(iVideoPlayer2->SetAutoScaleL(*iWindow, EAutoScaleBestFit));
|
sl@0
|
122 |
|
sl@0
|
123 |
iSurfaceWindow->SetBackgroundSurface(config, KScreenNumber);
|
sl@0
|
124 |
iSurfaceWindow->BeginRedraw();
|
sl@0
|
125 |
iSurfaceWindow->EndRedraw();
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
void RTestStepVclnt2CRP::MmsehSurfaceParametersChanged(const TSurfaceId& /*aId*/, const TRect& /*aCropRect*/, TVideoAspectRatio /*aAspectRatio*/)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
FailTest(_L("Unexpected call to MmsehSurfaceParametersChanged"));
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
void RTestStepVclnt2CRP::MmsehRemoveSurface(const TSurfaceId& /*aId*/)
|
sl@0
|
134 |
{
|
sl@0
|
135 |
FailTest(_L("Unexpected call to MmsehRemoveSurface"));
|
sl@0
|
136 |
}
|
sl@0
|
137 |
|
sl@0
|
138 |
void RTestStepVclnt2CRP::FailTest(const TDesC& aMessage)
|
sl@0
|
139 |
{
|
sl@0
|
140 |
ERR_PRINTF2(_L("%S"), &aMessage);
|
sl@0
|
141 |
iTestStepResult = EFail;
|
sl@0
|
142 |
iActiveScheduler->Stop();
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|