|
1 // Copyright (c) 2005-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 /** |
|
17 @file |
|
18 @internalComponent - Internal Symbian test code |
|
19 */ |
|
20 |
|
21 |
|
22 #if !defined(__TCONEINVALIDATE_H__) |
|
23 #define __TCONEINVALIDATE_H__ |
|
24 |
|
25 #include <coecntrl.h> |
|
26 #include <coeccntx.h> |
|
27 #include <gulgcmap.h> |
|
28 #include "TConeTestServer.h" |
|
29 #include "appfwk_test_AppUi.h" |
|
30 #include "TTransGc.h" |
|
31 |
|
32 /** Base control drawing class |
|
33 @test |
|
34 */ |
|
35 class CTestRectGc : public CCoeControl |
|
36 , public MCoeControlBackground |
|
37 { |
|
38 public: |
|
39 typedef enum |
|
40 { |
|
41 EBlank, |
|
42 EDrawRect, |
|
43 EDrawEllipse |
|
44 } TDrawType; |
|
45 |
|
46 friend class CTestRectBackground; |
|
47 friend class CComponentControl; |
|
48 |
|
49 public: |
|
50 void virtual ConstructL(TPoint, TSize, TRgb aPenColor, TRgb aBrushColor, CGraphicsContext::TBrushStyle aBrushStyle); |
|
51 ~CTestRectGc(); |
|
52 void Draw(const TRect& aRect) const; |
|
53 void SetPenColor(const TRgb &aPenColor); |
|
54 void SetBrushColor(const TRgb &aBrushColor); |
|
55 void SetBrushStyle(const CGraphicsContext::TBrushStyle aBrushStyle); |
|
56 void SetDrawType(const TDrawType DrawType); |
|
57 |
|
58 void NextFrame(); |
|
59 |
|
60 // MCoeControlBackground |
|
61 void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const; |
|
62 |
|
63 static CFbsBitmap* iBmpBackground; |
|
64 |
|
65 protected: |
|
66 TDrawType iDrawType; |
|
67 TRgb iPenColor; |
|
68 TRgb iBrushColor; |
|
69 CGraphicsContext::TBrushStyle iBrushStyle; |
|
70 int iFrameNo; |
|
71 |
|
72 }; |
|
73 |
|
74 /** Image display/drawing control |
|
75 @test |
|
76 */ |
|
77 class CTestRectImageGc : public CTestRectGc |
|
78 { |
|
79 public: |
|
80 |
|
81 ~CTestRectImageGc() |
|
82 { |
|
83 }; |
|
84 void Draw(const TRect& aRect) const; |
|
85 void SetBitmap(CFbsBitmap* aBmp) |
|
86 { |
|
87 iBmp = aBmp; |
|
88 } |
|
89 CFbsBitmap* Bitmap() |
|
90 { |
|
91 return iBmp; |
|
92 } |
|
93 |
|
94 protected: |
|
95 CFbsBitmap* iBmp; |
|
96 }; |
|
97 |
|
98 /** Hierarchical animated component control class |
|
99 @test |
|
100 */ |
|
101 class CComponentControl : public CTestRectGc |
|
102 { |
|
103 public: |
|
104 |
|
105 ~CComponentControl(); |
|
106 void ConstructL(TInt aChildren, TInt aOwners, TPoint aPt, TSize aSize, TRgb aPenColor, TRgb aBrushColor, CGraphicsContext::TBrushStyle aBrushStyle); |
|
107 void CreateChildControlL(TInt aChildren, TInt aOwners, TPoint aPt, TSize aSize, TRgb aPenColor, TRgb aBrushColor, CGraphicsContext::TBrushStyle aBrushStyle); |
|
108 |
|
109 void Draw(const TRect& aRect) const; |
|
110 void AnimateComponents(); |
|
111 }; |
|
112 |
|
113 /** Offscreen class |
|
114 @test |
|
115 */ |
|
116 class COffScreenBitmapGc |
|
117 { |
|
118 public: |
|
119 CTransGc* iGraphContext; |
|
120 CFbsBitGc* iMainFbsBitGc; |
|
121 |
|
122 CFbsBitmapDevice* iBitmapDevice2; |
|
123 CWsBitmap *iBitmapView; |
|
124 |
|
125 COffScreenBitmapGc(); |
|
126 public: |
|
127 ~COffScreenBitmapGc(); |
|
128 static COffScreenBitmapGc* NewL(const TSize &aSize); |
|
129 CTransGc *OffScreenGc(); |
|
130 CWsBitmap *GetBitmap(); |
|
131 }; |
|
132 |
|
133 /** Main control class |
|
134 @test |
|
135 */ |
|
136 class CTestRectBackground : public CTestRectGc |
|
137 { |
|
138 public: |
|
139 void ConstructL(); |
|
140 ~CTestRectBackground(); |
|
141 |
|
142 protected: |
|
143 |
|
144 void Draw(const TRect& aRect) const; |
|
145 private: // new functions |
|
146 |
|
147 |
|
148 public: |
|
149 CComponentControl* iControl; //Main animated control |
|
150 CTestRectImageGc* iControlImage; //Region drawn to offscreen |
|
151 CTestRectImageGc* iControlImage2; //Region drawn to offscreen plus background |
|
152 COffScreenBitmapGc *iOffScreen; //The physical offscreen bitmap |
|
153 COffScreenBitmapGc *iOffScreen2; //The 2nd physical offscreen bitmap |
|
154 |
|
155 public: |
|
156 void CreateComponentControlL(TInt aNumChildren, TInt aOwnerMask); |
|
157 |
|
158 }; |
|
159 |
|
160 /** Test step class |
|
161 @test |
|
162 */ |
|
163 class CTConeInvalidateStep : public CTmsTestStep |
|
164 { |
|
165 public: |
|
166 CTConeInvalidateStep(); |
|
167 ~CTConeInvalidateStep(); |
|
168 virtual TVerdict doTestStepL(); |
|
169 void ConstructAppL(CCoeEnv* aCoe); |
|
170 |
|
171 private: |
|
172 }; |
|
173 |
|
174 /** Test application |
|
175 @test |
|
176 */ |
|
177 class CTConeInvalidateAppUi : public CTestCoeAppUi |
|
178 { |
|
179 friend class CTestRectBackground; |
|
180 friend class CTestRectGc; |
|
181 public: |
|
182 CTConeInvalidateAppUi(CTmsTestStep* aStep); |
|
183 ~CTConeInvalidateAppUi(); |
|
184 void ConstructL(); |
|
185 private: // from CCoeAppUi |
|
186 TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
187 private: // utility |
|
188 void RunTestStepL(TInt aStepNum); |
|
189 protected: |
|
190 CTestRectBackground* iViewControl; //The main application control |
|
191 }; |
|
192 |
|
193 |
|
194 _LIT(KTConeInvalidateStep,"TConeInvalidate"); |
|
195 |
|
196 #endif |
|
197 |
|
198 |