os/mm/mmlibs/mmfw/tsrc/mmfunittest/srtdecoder/inc/testsrtdecoder.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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
#ifndef TESTSRTDECODER_H
sl@0
    17
#define TESTSRTDECODER_H
sl@0
    18
sl@0
    19
#include <fbs.h> 
sl@0
    20
#include <w32std.h>
sl@0
    21
#include <testframework.h>
sl@0
    22
sl@0
    23
class CSrtReader;
sl@0
    24
class CSrtSubtitleDecoder;
sl@0
    25
sl@0
    26
// Generic test step class with utilities
sl@0
    27
class RTestSrtDecoderStep : public RTestStep
sl@0
    28
    {
sl@0
    29
protected:
sl@0
    30
	static TBool CompareFilesL(RFs &aFs, const TDesC& aFilePath1, const TDesC& aFilePath2);
sl@0
    31
	void InitializeTestStepL(TBool aCreateSrtReaderOnly, const TDesC& aSrtFilePath);
sl@0
    32
	void UnInitializeTestStep();
sl@0
    33
	TBool IsFontAvailableL(const TDesC& aTypefaceName);
sl@0
    34
	TBool CompareBmpFilesL(TInt aStartIndex, TInt aEndIndex, const TDesC& aSrcFilePathSpec, const TDesC& aDestFilePathSpec);
sl@0
    35
	void DeleteTempFiles(TInt aStartIndex, TInt aEndIndex, const TDesC& aFilePathSpec);
sl@0
    36
	
sl@0
    37
protected:	
sl@0
    38
	CSrtReader* iSrtReader;
sl@0
    39
	CSrtSubtitleDecoder* iSrtDecoder;
sl@0
    40
    RFbsSession iRbsSession;
sl@0
    41
	
sl@0
    42
private:
sl@0
    43
	TBool iCreateSrtReaderOnly;
sl@0
    44
    };
sl@0
    45
sl@0
    46
/* 
sl@0
    47
Test decoding a valid srt file from various positions
sl@0
    48
MM-MMF-SUBTITLE-SRTDECODER-U-0002-HP
sl@0
    49
*/
sl@0
    50
NONSHARABLE_CLASS (RTestSrtDecoderStep0002) : public RTestSrtDecoderStep
sl@0
    51
	{
sl@0
    52
public:
sl@0
    53
    RTestSrtDecoderStep0002();
sl@0
    54
    
sl@0
    55
protected:
sl@0
    56
	// from RTestStep;
sl@0
    57
	TVerdict DoTestStepL();
sl@0
    58
	TVerdict DoTestStepPreambleL();
sl@0
    59
	TVerdict DoTestStepPostambleL();
sl@0
    60
	
sl@0
    61
private:
sl@0
    62
    void InitWservL();
sl@0
    63
    void UninitWserv();
sl@0
    64
    void TestGetNextFrameL();
sl@0
    65
	void TestGetNextFrameByPositionsL(const TTimeIntervalMicroSeconds& aPosition, TInt aExpectedNumOfFrames, TBool aSaveBitmap);
sl@0
    66
	void PrepGc();
sl@0
    67
	void RetireGc();
sl@0
    68
	void DrawBitmap(CFbsBitmap& aBitmap);
sl@0
    69
	
sl@0
    70
private:
sl@0
    71
    RWsSession iWs;
sl@0
    72
    CWsScreenDevice* iScreen;
sl@0
    73
    RWindow* iWindow;
sl@0
    74
    RWindowGroup iRootWindow;
sl@0
    75
    CWindowGc *iGc;
sl@0
    76
    CActiveScheduler* iActiveScheduler;
sl@0
    77
	TBool iActiveSchedulerStarted;
sl@0
    78
	};
sl@0
    79
	
sl@0
    80
/* 
sl@0
    81
Test decoding an invalid srt file from beginning
sl@0
    82
MM-MMF-SUBTITLE-SRTDECODER-U-0101-HP 
sl@0
    83
*/
sl@0
    84
sl@0
    85
NONSHARABLE_CLASS (RTestSrtDecoderStep0101) : public RTestSrtDecoderStep
sl@0
    86
	{
sl@0
    87
public:
sl@0
    88
    RTestSrtDecoderStep0101();
sl@0
    89
sl@0
    90
private:
sl@0
    91
	// from RTestStep;
sl@0
    92
	TVerdict DoTestStepL();
sl@0
    93
	TVerdict DoTestStepPreambleL();
sl@0
    94
	TVerdict DoTestStepPostambleL();
sl@0
    95
		
sl@0
    96
private:
sl@0
    97
	void TestGetNextFrameL();
sl@0
    98
	};
sl@0
    99
	
sl@0
   100
/* 
sl@0
   101
Out of memory test for srt decoder
sl@0
   102
MM-MMF-SUBTITLE-SRTDECODER-U-0103-HP
sl@0
   103
*/
sl@0
   104
NONSHARABLE_CLASS(RTestSrtDecoderStep0103) : public RTestStep
sl@0
   105
	{
sl@0
   106
public:
sl@0
   107
	RTestSrtDecoderStep0103();
sl@0
   108
sl@0
   109
protected:
sl@0
   110
	// from RTestStep;
sl@0
   111
	TVerdict DoTestStepL();
sl@0
   112
	TVerdict DoTestStepPreambleL();
sl@0
   113
	TVerdict DoTestStepPostambleL();
sl@0
   114
sl@0
   115
private:
sl@0
   116
	void TestGetNextFrameL(CFbsBitmap& aBitmap);
sl@0
   117
	};
sl@0
   118
sl@0
   119
/* 
sl@0
   120
Start called twice panic test
sl@0
   121
MM-MMF-SUBTITLE-SRTDECODER-U-0105-HP
sl@0
   122
*/
sl@0
   123
NONSHARABLE_CLASS(RTestSrtDecoderStep0105) : public RTestSrtDecoderStep
sl@0
   124
	{
sl@0
   125
public:
sl@0
   126
	RTestSrtDecoderStep0105();
sl@0
   127
sl@0
   128
protected:
sl@0
   129
	// from RTestStep;
sl@0
   130
	TVerdict DoTestStepL();
sl@0
   131
	TVerdict DoTestStepPreambleL();
sl@0
   132
	TVerdict DoTestStepPostambleL();
sl@0
   133
	};
sl@0
   134
sl@0
   135
#endif // TESTSRTDECODER_H
sl@0
   136