os/mm/mmlibs/mmfw/tsrc/mmfunittest/srtdecoder/inc/testsrtdecoder.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/srtdecoder/inc/testsrtdecoder.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,136 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef TESTSRTDECODER_H
    1.20 +#define TESTSRTDECODER_H
    1.21 +
    1.22 +#include <fbs.h> 
    1.23 +#include <w32std.h>
    1.24 +#include <testframework.h>
    1.25 +
    1.26 +class CSrtReader;
    1.27 +class CSrtSubtitleDecoder;
    1.28 +
    1.29 +// Generic test step class with utilities
    1.30 +class RTestSrtDecoderStep : public RTestStep
    1.31 +    {
    1.32 +protected:
    1.33 +	static TBool CompareFilesL(RFs &aFs, const TDesC& aFilePath1, const TDesC& aFilePath2);
    1.34 +	void InitializeTestStepL(TBool aCreateSrtReaderOnly, const TDesC& aSrtFilePath);
    1.35 +	void UnInitializeTestStep();
    1.36 +	TBool IsFontAvailableL(const TDesC& aTypefaceName);
    1.37 +	TBool CompareBmpFilesL(TInt aStartIndex, TInt aEndIndex, const TDesC& aSrcFilePathSpec, const TDesC& aDestFilePathSpec);
    1.38 +	void DeleteTempFiles(TInt aStartIndex, TInt aEndIndex, const TDesC& aFilePathSpec);
    1.39 +	
    1.40 +protected:	
    1.41 +	CSrtReader* iSrtReader;
    1.42 +	CSrtSubtitleDecoder* iSrtDecoder;
    1.43 +    RFbsSession iRbsSession;
    1.44 +	
    1.45 +private:
    1.46 +	TBool iCreateSrtReaderOnly;
    1.47 +    };
    1.48 +
    1.49 +/* 
    1.50 +Test decoding a valid srt file from various positions
    1.51 +MM-MMF-SUBTITLE-SRTDECODER-U-0002-HP
    1.52 +*/
    1.53 +NONSHARABLE_CLASS (RTestSrtDecoderStep0002) : public RTestSrtDecoderStep
    1.54 +	{
    1.55 +public:
    1.56 +    RTestSrtDecoderStep0002();
    1.57 +    
    1.58 +protected:
    1.59 +	// from RTestStep;
    1.60 +	TVerdict DoTestStepL();
    1.61 +	TVerdict DoTestStepPreambleL();
    1.62 +	TVerdict DoTestStepPostambleL();
    1.63 +	
    1.64 +private:
    1.65 +    void InitWservL();
    1.66 +    void UninitWserv();
    1.67 +    void TestGetNextFrameL();
    1.68 +	void TestGetNextFrameByPositionsL(const TTimeIntervalMicroSeconds& aPosition, TInt aExpectedNumOfFrames, TBool aSaveBitmap);
    1.69 +	void PrepGc();
    1.70 +	void RetireGc();
    1.71 +	void DrawBitmap(CFbsBitmap& aBitmap);
    1.72 +	
    1.73 +private:
    1.74 +    RWsSession iWs;
    1.75 +    CWsScreenDevice* iScreen;
    1.76 +    RWindow* iWindow;
    1.77 +    RWindowGroup iRootWindow;
    1.78 +    CWindowGc *iGc;
    1.79 +    CActiveScheduler* iActiveScheduler;
    1.80 +	TBool iActiveSchedulerStarted;
    1.81 +	};
    1.82 +	
    1.83 +/* 
    1.84 +Test decoding an invalid srt file from beginning
    1.85 +MM-MMF-SUBTITLE-SRTDECODER-U-0101-HP 
    1.86 +*/
    1.87 +
    1.88 +NONSHARABLE_CLASS (RTestSrtDecoderStep0101) : public RTestSrtDecoderStep
    1.89 +	{
    1.90 +public:
    1.91 +    RTestSrtDecoderStep0101();
    1.92 +
    1.93 +private:
    1.94 +	// from RTestStep;
    1.95 +	TVerdict DoTestStepL();
    1.96 +	TVerdict DoTestStepPreambleL();
    1.97 +	TVerdict DoTestStepPostambleL();
    1.98 +		
    1.99 +private:
   1.100 +	void TestGetNextFrameL();
   1.101 +	};
   1.102 +	
   1.103 +/* 
   1.104 +Out of memory test for srt decoder
   1.105 +MM-MMF-SUBTITLE-SRTDECODER-U-0103-HP
   1.106 +*/
   1.107 +NONSHARABLE_CLASS(RTestSrtDecoderStep0103) : public RTestStep
   1.108 +	{
   1.109 +public:
   1.110 +	RTestSrtDecoderStep0103();
   1.111 +
   1.112 +protected:
   1.113 +	// from RTestStep;
   1.114 +	TVerdict DoTestStepL();
   1.115 +	TVerdict DoTestStepPreambleL();
   1.116 +	TVerdict DoTestStepPostambleL();
   1.117 +
   1.118 +private:
   1.119 +	void TestGetNextFrameL(CFbsBitmap& aBitmap);
   1.120 +	};
   1.121 +
   1.122 +/* 
   1.123 +Start called twice panic test
   1.124 +MM-MMF-SUBTITLE-SRTDECODER-U-0105-HP
   1.125 +*/
   1.126 +NONSHARABLE_CLASS(RTestSrtDecoderStep0105) : public RTestSrtDecoderStep
   1.127 +	{
   1.128 +public:
   1.129 +	RTestSrtDecoderStep0105();
   1.130 +
   1.131 +protected:
   1.132 +	// from RTestStep;
   1.133 +	TVerdict DoTestStepL();
   1.134 +	TVerdict DoTestStepPreambleL();
   1.135 +	TVerdict DoTestStepPostambleL();
   1.136 +	};
   1.137 +
   1.138 +#endif // TESTSRTDECODER_H
   1.139 +