|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef TESTSRTDECODER_H |
|
17 #define TESTSRTDECODER_H |
|
18 |
|
19 #include <fbs.h> |
|
20 #include <w32std.h> |
|
21 #include <testframework.h> |
|
22 |
|
23 class CSrtReader; |
|
24 class CSrtSubtitleDecoder; |
|
25 |
|
26 // Generic test step class with utilities |
|
27 class RTestSrtDecoderStep : public RTestStep |
|
28 { |
|
29 protected: |
|
30 static TBool CompareFilesL(RFs &aFs, const TDesC& aFilePath1, const TDesC& aFilePath2); |
|
31 void InitializeTestStepL(TBool aCreateSrtReaderOnly, const TDesC& aSrtFilePath); |
|
32 void UnInitializeTestStep(); |
|
33 TBool IsFontAvailableL(const TDesC& aTypefaceName); |
|
34 TBool CompareBmpFilesL(TInt aStartIndex, TInt aEndIndex, const TDesC& aSrcFilePathSpec, const TDesC& aDestFilePathSpec); |
|
35 void DeleteTempFiles(TInt aStartIndex, TInt aEndIndex, const TDesC& aFilePathSpec); |
|
36 |
|
37 protected: |
|
38 CSrtReader* iSrtReader; |
|
39 CSrtSubtitleDecoder* iSrtDecoder; |
|
40 RFbsSession iRbsSession; |
|
41 |
|
42 private: |
|
43 TBool iCreateSrtReaderOnly; |
|
44 }; |
|
45 |
|
46 /* |
|
47 Test decoding a valid srt file from various positions |
|
48 MM-MMF-SUBTITLE-SRTDECODER-U-0002-HP |
|
49 */ |
|
50 NONSHARABLE_CLASS (RTestSrtDecoderStep0002) : public RTestSrtDecoderStep |
|
51 { |
|
52 public: |
|
53 RTestSrtDecoderStep0002(); |
|
54 |
|
55 protected: |
|
56 // from RTestStep; |
|
57 TVerdict DoTestStepL(); |
|
58 TVerdict DoTestStepPreambleL(); |
|
59 TVerdict DoTestStepPostambleL(); |
|
60 |
|
61 private: |
|
62 void InitWservL(); |
|
63 void UninitWserv(); |
|
64 void TestGetNextFrameL(); |
|
65 void TestGetNextFrameByPositionsL(const TTimeIntervalMicroSeconds& aPosition, TInt aExpectedNumOfFrames, TBool aSaveBitmap); |
|
66 void PrepGc(); |
|
67 void RetireGc(); |
|
68 void DrawBitmap(CFbsBitmap& aBitmap); |
|
69 |
|
70 private: |
|
71 RWsSession iWs; |
|
72 CWsScreenDevice* iScreen; |
|
73 RWindow* iWindow; |
|
74 RWindowGroup iRootWindow; |
|
75 CWindowGc *iGc; |
|
76 CActiveScheduler* iActiveScheduler; |
|
77 TBool iActiveSchedulerStarted; |
|
78 }; |
|
79 |
|
80 /* |
|
81 Test decoding an invalid srt file from beginning |
|
82 MM-MMF-SUBTITLE-SRTDECODER-U-0101-HP |
|
83 */ |
|
84 |
|
85 NONSHARABLE_CLASS (RTestSrtDecoderStep0101) : public RTestSrtDecoderStep |
|
86 { |
|
87 public: |
|
88 RTestSrtDecoderStep0101(); |
|
89 |
|
90 private: |
|
91 // from RTestStep; |
|
92 TVerdict DoTestStepL(); |
|
93 TVerdict DoTestStepPreambleL(); |
|
94 TVerdict DoTestStepPostambleL(); |
|
95 |
|
96 private: |
|
97 void TestGetNextFrameL(); |
|
98 }; |
|
99 |
|
100 /* |
|
101 Out of memory test for srt decoder |
|
102 MM-MMF-SUBTITLE-SRTDECODER-U-0103-HP |
|
103 */ |
|
104 NONSHARABLE_CLASS(RTestSrtDecoderStep0103) : public RTestStep |
|
105 { |
|
106 public: |
|
107 RTestSrtDecoderStep0103(); |
|
108 |
|
109 protected: |
|
110 // from RTestStep; |
|
111 TVerdict DoTestStepL(); |
|
112 TVerdict DoTestStepPreambleL(); |
|
113 TVerdict DoTestStepPostambleL(); |
|
114 |
|
115 private: |
|
116 void TestGetNextFrameL(CFbsBitmap& aBitmap); |
|
117 }; |
|
118 |
|
119 /* |
|
120 Start called twice panic test |
|
121 MM-MMF-SUBTITLE-SRTDECODER-U-0105-HP |
|
122 */ |
|
123 NONSHARABLE_CLASS(RTestSrtDecoderStep0105) : public RTestSrtDecoderStep |
|
124 { |
|
125 public: |
|
126 RTestSrtDecoderStep0105(); |
|
127 |
|
128 protected: |
|
129 // from RTestStep; |
|
130 TVerdict DoTestStepL(); |
|
131 TVerdict DoTestStepPreambleL(); |
|
132 TVerdict DoTestStepPostambleL(); |
|
133 }; |
|
134 |
|
135 #endif // TESTSRTDECODER_H |
|
136 |