sl@0
|
1 |
// Copyright (c) 2007-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 <videoframebuffer.h>
|
sl@0
|
17 |
#include "testbuffer.h"
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
RTestVideoFrameBufferStep* RTestVideoFrameBufferStep::NewL()
|
sl@0
|
21 |
{
|
sl@0
|
22 |
RTestVideoFrameBufferStep* self = new (ELeave) RTestVideoFrameBufferStep();
|
sl@0
|
23 |
return self;
|
sl@0
|
24 |
}
|
sl@0
|
25 |
|
sl@0
|
26 |
RTestVideoFrameBufferStep::RTestVideoFrameBufferStep()
|
sl@0
|
27 |
{
|
sl@0
|
28 |
iTestStepName = _L("MM-MMF-VIDREND-U-0001");
|
sl@0
|
29 |
}
|
sl@0
|
30 |
|
sl@0
|
31 |
TVerdict RTestVideoFrameBufferStep::DoTestStepL()
|
sl@0
|
32 |
{
|
sl@0
|
33 |
INFO_PRINTF1(_L("Check TVideoFrameBuffer"));
|
sl@0
|
34 |
|
sl@0
|
35 |
TVerdict result = EPass;
|
sl@0
|
36 |
|
sl@0
|
37 |
const TInt KStride = 8;
|
sl@0
|
38 |
const TInt KBufferId = 2;
|
sl@0
|
39 |
const TInt KOffsetInChunk = 4;
|
sl@0
|
40 |
const TInt KChunkSize = 20;
|
sl@0
|
41 |
const TInt KMaxChunkSize = 40;
|
sl@0
|
42 |
RChunk chunk;
|
sl@0
|
43 |
TInt err = chunk.CreateLocal(KChunkSize, KMaxChunkSize);
|
sl@0
|
44 |
if (err != KErrNone)
|
sl@0
|
45 |
{
|
sl@0
|
46 |
ERR_PRINTF2(_L("Error - RChunk::CreateLocal returned %d"), err);
|
sl@0
|
47 |
result = EFail;
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
TUncompressedVideoFormat testFormat;
|
sl@0
|
51 |
testFormat.iDataFormat = ERgbRawData;
|
sl@0
|
52 |
testFormat.iRgbFormat = ERgb32bit888;
|
sl@0
|
53 |
|
sl@0
|
54 |
TVideoFrameBuffer buffer(testFormat, KStride, KBufferId, chunk, KOffsetInChunk);
|
sl@0
|
55 |
|
sl@0
|
56 |
if (buffer.Stride() != KStride)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
ERR_PRINTF2(_L("Error - unexpected stride %d returned"), buffer.Stride());
|
sl@0
|
59 |
result = EFail;
|
sl@0
|
60 |
}
|
sl@0
|
61 |
else if (buffer.BufferId() != KBufferId)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
ERR_PRINTF2(_L("Error - unexpected buffer id %d returned"), buffer.BufferId());
|
sl@0
|
64 |
result = EFail;
|
sl@0
|
65 |
}
|
sl@0
|
66 |
else if (buffer.Chunk().Handle() != chunk.Handle())
|
sl@0
|
67 |
{
|
sl@0
|
68 |
ERR_PRINTF1(_L("Error - unexpected chunk returned"));
|
sl@0
|
69 |
result = EFail;
|
sl@0
|
70 |
}
|
sl@0
|
71 |
else if (buffer.Buffer() != chunk.Base()+KOffsetInChunk)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
ERR_PRINTF1(_L("Error - unexpected buffer"));
|
sl@0
|
74 |
result = EFail;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
else if (!(buffer.Format() == testFormat))
|
sl@0
|
77 |
{
|
sl@0
|
78 |
ERR_PRINTF1(_L("Error - unexpected format returned"));
|
sl@0
|
79 |
result = EFail;
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
chunk.Close();
|
sl@0
|
83 |
return result;
|
sl@0
|
84 |
}
|