|
1 |
|
2 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 // All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Nokia Corporation - initial contribution. |
|
11 // |
|
12 // Contributors: |
|
13 // |
|
14 // Description: |
|
15 // |
|
16 |
|
17 /** |
|
18 @file |
|
19 @test |
|
20 @internalComponent - Internal Symbian test code |
|
21 */ |
|
22 |
|
23 #ifndef __TFADE_H__ |
|
24 #define __TFADE_H__ |
|
25 |
|
26 #include "AUTO.H" |
|
27 |
|
28 #if defined(__MARM__) |
|
29 #define SMALL_RECTS |
|
30 #endif |
|
31 #define SIZE_X 10 |
|
32 #define SIZE_Y 5 |
|
33 #define DRAW_MODE EColor64K //Mode used for testing fadded drawing |
|
34 #define BLACK_NORMAL 128 |
|
35 #define WHITE_NORMAL 255 |
|
36 #define BLACK_ALTERNATE 0 |
|
37 #define WHITE_ALTERNATE 127 |
|
38 #define NUMBER_OF_WINDOWS 16 |
|
39 |
|
40 #define MODE_LT_64K(mode) (TDisplayModeUtils::NumDisplayModeColors(mode)<65536) |
|
41 |
|
42 #define ETrue 1 |
|
43 #define EFalse 0 |
|
44 |
|
45 class CTFade : public CTWsGraphicsBase |
|
46 { |
|
47 public: |
|
48 CTFade(CTestStep* aStep); |
|
49 ~CTFade(); |
|
50 void ConstructL(); |
|
51 TInt Content(); |
|
52 void Drawing(TInt aDrawFunc, CBitmapContext *gc); |
|
53 //Different Tests |
|
54 void ColorTest(); |
|
55 void BlankWindowL(); |
|
56 void FadeChildrenL(); |
|
57 void FadeChildrenAfterNewChildIsCreatedL(); |
|
58 void FadeBehindL(); |
|
59 void ColorTest2(); |
|
60 void FadeTest(); |
|
61 void Draw(TBool aAlternativeFade=EFalse); |
|
62 void ObscuredL(); |
|
63 void MovingL(); |
|
64 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
65 void GCDraw(); |
|
66 #endif |
|
67 void SystemFadeL(); |
|
68 void SystemAlternateFadeL(); |
|
69 void FadeBehindWhenMovedL(); |
|
70 void FadeBehindTransparentWindowL(); |
|
71 protected: |
|
72 //from CTGraphicsStep |
|
73 virtual void RunTestCaseL(TInt aCurTestCase); |
|
74 private: |
|
75 void CreateBlankWindowL(); |
|
76 void DestroyBlankWindow(); |
|
77 void CreateBackupWindowL(TBool aMaintainBackup); |
|
78 void CreateRedrawWindowL(); |
|
79 void DestroyDrawableWindow(); |
|
80 void CreateBitmapsL(); |
|
81 void DestroyBitmaps(); |
|
82 void Draw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse, TBool aFade=EFalse); |
|
83 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
84 void GCDraw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse); |
|
85 #endif |
|
86 void Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *gc); |
|
87 void CompareWithBitmap(TBool aFade); |
|
88 void CompareWindows(TBool aAlternativeFade=EFalse); |
|
89 void TestStrips(TRect aRect,TInt aHeight,TInt aNumNotFaded,TBool aInvert=EFalse); |
|
90 void TestBlocks(TRect aRect,TSize aSize,TInt aNumNotFaded,TBool aInvert=EFalse); |
|
91 TInt Fade4(TInt aGray4); |
|
92 TInt Fade16(TInt aGray16); |
|
93 TRgb FadeRgb(TRgb aColor); |
|
94 TRgb FadeRgb(TRgb aColor, TInt aFadeMapFactor, TInt aFadeMapOffset); |
|
95 inline void ViewDelay(); |
|
96 private: |
|
97 CTBlankWindow* iBlankWin; |
|
98 CTDrawableWin* iWin; |
|
99 TBool iOwnWindow; |
|
100 TRect iWindowRect; |
|
101 TRect iBaseRect; |
|
102 CFbsBitmap iNormalBitmap; |
|
103 CFbsBitmap iFadedBitmap; |
|
104 CFbsBitGc *iNormalBitGc; |
|
105 CFbsBitGc *iFadedBitGc; |
|
106 CFbsDevice *iNormalBitmapDevice; |
|
107 CFbsDevice *iFadedBitmapDevice; |
|
108 TInt iContent; |
|
109 TDisplayMode iBaseWinMode; |
|
110 TDisplayMode iDeviceDisplayMode; |
|
111 TSize iTestWinSize; |
|
112 TDisplayMode iFadeDrawMode; |
|
113 CFbsBitmap *iTestWinCopy; |
|
114 CFbsBitmap *iCheckWinCopy; |
|
115 #if defined (__MARM_THUMB__) |
|
116 GLDEF_D TBool CanFade; |
|
117 GLDEF_D TBool CanFadeSet; |
|
118 #endif |
|
119 }; |
|
120 |
|
121 class CRedrawWin : public CTWin |
|
122 { |
|
123 public: |
|
124 CRedrawWin(CTFade *aTest); |
|
125 void ConstructL(TRect aArea); |
|
126 ~CRedrawWin(); |
|
127 void Draw(); |
|
128 |
|
129 protected: |
|
130 CTFade* iTest; |
|
131 }; |
|
132 |
|
133 class CTFadeStep : public CTGraphicsStep |
|
134 { |
|
135 public: |
|
136 CTFadeStep(); |
|
137 protected: |
|
138 //from CTGraphicsStep |
|
139 virtual CTGraphicsBase* CreateTestL(); |
|
140 }; |
|
141 |
|
142 _LIT(KTFadeStep,"TFade"); |
|
143 |
|
144 |
|
145 #endif |