sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef TESTSRTDECODER_H sl@0: #define TESTSRTDECODER_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: class CSrtReader; sl@0: class CSrtSubtitleDecoder; sl@0: sl@0: // Generic test step class with utilities sl@0: class RTestSrtDecoderStep : public RTestStep sl@0: { sl@0: protected: sl@0: static TBool CompareFilesL(RFs &aFs, const TDesC& aFilePath1, const TDesC& aFilePath2); sl@0: void InitializeTestStepL(TBool aCreateSrtReaderOnly, const TDesC& aSrtFilePath); sl@0: void UnInitializeTestStep(); sl@0: TBool IsFontAvailableL(const TDesC& aTypefaceName); sl@0: TBool CompareBmpFilesL(TInt aStartIndex, TInt aEndIndex, const TDesC& aSrcFilePathSpec, const TDesC& aDestFilePathSpec); sl@0: void DeleteTempFiles(TInt aStartIndex, TInt aEndIndex, const TDesC& aFilePathSpec); sl@0: sl@0: protected: sl@0: CSrtReader* iSrtReader; sl@0: CSrtSubtitleDecoder* iSrtDecoder; sl@0: RFbsSession iRbsSession; sl@0: sl@0: private: sl@0: TBool iCreateSrtReaderOnly; sl@0: }; sl@0: sl@0: /* sl@0: Test decoding a valid srt file from various positions sl@0: MM-MMF-SUBTITLE-SRTDECODER-U-0002-HP sl@0: */ sl@0: NONSHARABLE_CLASS (RTestSrtDecoderStep0002) : public RTestSrtDecoderStep sl@0: { sl@0: public: sl@0: RTestSrtDecoderStep0002(); sl@0: sl@0: protected: sl@0: // from RTestStep; sl@0: TVerdict DoTestStepL(); sl@0: TVerdict DoTestStepPreambleL(); sl@0: TVerdict DoTestStepPostambleL(); sl@0: sl@0: private: sl@0: void InitWservL(); sl@0: void UninitWserv(); sl@0: void TestGetNextFrameL(); sl@0: void TestGetNextFrameByPositionsL(const TTimeIntervalMicroSeconds& aPosition, TInt aExpectedNumOfFrames, TBool aSaveBitmap); sl@0: void PrepGc(); sl@0: void RetireGc(); sl@0: void DrawBitmap(CFbsBitmap& aBitmap); sl@0: sl@0: private: sl@0: RWsSession iWs; sl@0: CWsScreenDevice* iScreen; sl@0: RWindow* iWindow; sl@0: RWindowGroup iRootWindow; sl@0: CWindowGc *iGc; sl@0: CActiveScheduler* iActiveScheduler; sl@0: TBool iActiveSchedulerStarted; sl@0: }; sl@0: sl@0: /* sl@0: Test decoding an invalid srt file from beginning sl@0: MM-MMF-SUBTITLE-SRTDECODER-U-0101-HP sl@0: */ sl@0: sl@0: NONSHARABLE_CLASS (RTestSrtDecoderStep0101) : public RTestSrtDecoderStep sl@0: { sl@0: public: sl@0: RTestSrtDecoderStep0101(); sl@0: sl@0: private: sl@0: // from RTestStep; sl@0: TVerdict DoTestStepL(); sl@0: TVerdict DoTestStepPreambleL(); sl@0: TVerdict DoTestStepPostambleL(); sl@0: sl@0: private: sl@0: void TestGetNextFrameL(); sl@0: }; sl@0: sl@0: /* sl@0: Out of memory test for srt decoder sl@0: MM-MMF-SUBTITLE-SRTDECODER-U-0103-HP sl@0: */ sl@0: NONSHARABLE_CLASS(RTestSrtDecoderStep0103) : public RTestStep sl@0: { sl@0: public: sl@0: RTestSrtDecoderStep0103(); sl@0: sl@0: protected: sl@0: // from RTestStep; sl@0: TVerdict DoTestStepL(); sl@0: TVerdict DoTestStepPreambleL(); sl@0: TVerdict DoTestStepPostambleL(); sl@0: sl@0: private: sl@0: void TestGetNextFrameL(CFbsBitmap& aBitmap); sl@0: }; sl@0: sl@0: /* sl@0: Start called twice panic test sl@0: MM-MMF-SUBTITLE-SRTDECODER-U-0105-HP sl@0: */ sl@0: NONSHARABLE_CLASS(RTestSrtDecoderStep0105) : public RTestSrtDecoderStep sl@0: { sl@0: public: sl@0: RTestSrtDecoderStep0105(); sl@0: sl@0: protected: sl@0: // from RTestStep; sl@0: TVerdict DoTestStepL(); sl@0: TVerdict DoTestStepPreambleL(); sl@0: TVerdict DoTestStepPostambleL(); sl@0: }; sl@0: sl@0: #endif // TESTSRTDECODER_H sl@0: