|
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 __TSCROLL_H__ |
|
24 #define __TSCROLL_H__ |
|
25 |
|
26 #include <e32std.h> |
|
27 #include <w32std.h> |
|
28 #include "../tlib/testbase.h" |
|
29 #include <bitstd.h> |
|
30 #include "AUTO.H" |
|
31 #include "TGraphicsHarness.h" |
|
32 |
|
33 class CTScroll; |
|
34 class CScrollTestBase; |
|
35 |
|
36 class CScrollWindowNorm : public CTWin |
|
37 { |
|
38 public: |
|
39 CScrollWindowNorm(); |
|
40 void Draw(); |
|
41 void SetScrollTest(CScrollTestBase *aScrollTest); |
|
42 private: |
|
43 CScrollTestBase *iScrollTest; |
|
44 }; |
|
45 |
|
46 class CScrollWindowBackedUp : public CTBackedUpWin |
|
47 { |
|
48 public: |
|
49 CScrollWindowBackedUp(TDisplayMode aDisplayMode); |
|
50 void Draw(); |
|
51 void SetScrollTest(CScrollTestBase *aScrollTest); |
|
52 private: |
|
53 CScrollTestBase *iScrollTest; |
|
54 }; |
|
55 |
|
56 class CScrollTestBase : public CBase |
|
57 { |
|
58 public: |
|
59 ~CScrollTestBase(); |
|
60 virtual void ConstructL(const TPoint &aPos, const TSize &aSize)=0; |
|
61 virtual void DoTestScroll(const TPoint &aOffset)=0; |
|
62 virtual void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset)=0; |
|
63 virtual void DoTestScroll(const TPoint &aOffset, const TRect &aRect)=0; |
|
64 virtual void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)=0; |
|
65 virtual void Reset(); |
|
66 TPoint Offset() const; |
|
67 virtual CTDrawableWin *ScrollWin() const=0; |
|
68 virtual void DoInvalidate(); |
|
69 virtual void Redraw()=0; |
|
70 protected: |
|
71 TSize iSize; |
|
72 TPoint iOffset; |
|
73 friend class CTScroll; |
|
74 RRegion iInvalid; |
|
75 CTBlankWindow *iBlankWin; |
|
76 }; |
|
77 |
|
78 class CScrollTestBaseNorm : public CScrollTestBase |
|
79 { |
|
80 public: |
|
81 void ConstructL(const TPoint &aPos, const TSize &aSize); |
|
82 ~CScrollTestBaseNorm(); |
|
83 virtual CTDrawableWin *ScrollWin() const; |
|
84 virtual void Reset(); |
|
85 void VisibleRegion(RRegion &aRegion); |
|
86 void AdjustTestScrollRegion(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect); |
|
87 void DrawScrollWin(const TPoint &aOffset, const TSize &aSize); |
|
88 void Redraw(); |
|
89 protected: |
|
90 CScrollWindowNorm *iScrollWin; |
|
91 }; |
|
92 |
|
93 class CScrollWindow1 : public CScrollTestBaseNorm |
|
94 // |
|
95 // Used as control window for a normal redraw window |
|
96 // |
|
97 { |
|
98 public: |
|
99 void DoTestScroll(const TPoint &aOffset); |
|
100 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset); |
|
101 void DoTestScroll(const TPoint &aOffset, const TRect &aRect); |
|
102 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect); |
|
103 void DoInvalidate(); |
|
104 }; |
|
105 |
|
106 class CScrollWindow2 : public CScrollTestBaseNorm |
|
107 // |
|
108 // Used to test a normal redraw window |
|
109 // |
|
110 { |
|
111 public: |
|
112 CScrollWindow2(CTScroll *aTest); |
|
113 virtual void Draw(); |
|
114 virtual void Reset(); |
|
115 void DoTestScroll(const TPoint &aOffset); |
|
116 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset); |
|
117 void DoTestScroll(const TPoint &aOffset, const TRect &aRect); |
|
118 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect); |
|
119 private: |
|
120 TBool iClipped; |
|
121 CTScroll *iTest; |
|
122 }; |
|
123 |
|
124 class CScrollWindow3 : public CScrollTestBaseNorm |
|
125 // |
|
126 // Used as control window for testing backed up windows |
|
127 // |
|
128 { |
|
129 public: |
|
130 void ConstructL(const TPoint &aPos, const TSize &aSize); |
|
131 ~CScrollWindow3(); |
|
132 virtual void Reset(); |
|
133 void Draw(); |
|
134 void DoTestScroll(const TPoint &aOffset); |
|
135 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset); |
|
136 void DoTestScroll(const TPoint &aOffset, const TRect &aRect); |
|
137 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect); |
|
138 void DoInvalidate(); |
|
139 void DrawScrollBit(); |
|
140 private: |
|
141 CFbsBitmap *iBitmap; |
|
142 CFbsDevice *iBitmapDevice; |
|
143 CFbsBitGc *iBitmapGc; |
|
144 }; |
|
145 |
|
146 class CScrollWindow4 : public CScrollTestBase |
|
147 // |
|
148 // Tests a backed up window |
|
149 // |
|
150 { |
|
151 public: |
|
152 ~CScrollWindow4(); |
|
153 void ConstructL(const TPoint &aPos, const TSize &aSize); |
|
154 void DoTestScroll(const TPoint &aOffset); |
|
155 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset); |
|
156 void DoTestScroll(const TPoint &aOffset, const TRect &aRect); |
|
157 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect); |
|
158 virtual CTDrawableWin *ScrollWin() const; |
|
159 virtual void Reset(); |
|
160 void Redraw(); |
|
161 protected: |
|
162 CScrollWindowBackedUp *iScrollWin; |
|
163 }; |
|
164 |
|
165 class CTScroll : public CTWsGraphicsBase |
|
166 { |
|
167 public: |
|
168 CTScroll(CTestStep* aStep); |
|
169 ~CTScroll(); |
|
170 void ConstructL(); |
|
171 void CheckScrollWindows(); |
|
172 void DoTestScroll(const TPoint &aOffset); |
|
173 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset); |
|
174 void DoTestScroll(const TPoint &aOffset, const TRect &aRect); |
|
175 void DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect); |
|
176 void FinishedRectScrolls(); |
|
177 void CheckOomScroll(); |
|
178 void OomScrolling(); |
|
179 void DemoWindowScrollL(); |
|
180 protected: |
|
181 //from CTGraphicsStep |
|
182 virtual void RunTestCaseL(TInt aCurTestCase); |
|
183 private: |
|
184 TSize iWinSize; |
|
185 TInt iMode; |
|
186 TBool iDoCheck; |
|
187 CScrollTestBase *iBaseScrollWin; |
|
188 CScrollTestBase *iTestScrollWin; |
|
189 }; |
|
190 |
|
191 class CTScrollStep : public CTGraphicsStep |
|
192 { |
|
193 public: |
|
194 CTScrollStep(); |
|
195 protected: |
|
196 //from CTGraphicsStep |
|
197 virtual CTGraphicsBase* CreateTestL(); |
|
198 }; |
|
199 |
|
200 _LIT(KTScrollStep,"TScroll"); |
|
201 |
|
202 |
|
203 #endif |