103
|
1 |
// Copyright (c) 1996-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 |
// Window scroll tests
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@test
|
|
21 |
@internalComponent - Internal Symbian test code
|
|
22 |
*/
|
|
23 |
|
|
24 |
#include "TSCROLL.H"
|
|
25 |
|
|
26 |
#pragma warning(disable : 4710)
|
|
27 |
|
|
28 |
//
|
|
29 |
// Scroll window, used to test the Scroll() command
|
|
30 |
//
|
|
31 |
|
|
32 |
void DrawScrollWin(CBitmapContext *aGc, const TPoint &aOffset, const TSize &aSize)
|
|
33 |
{
|
|
34 |
aGc->Clear();
|
|
35 |
TPoint drawBase(-10,-20);
|
|
36 |
TSize drawSize(aSize.iWidth-2*drawBase.iX,aSize.iHeight-2*drawBase.iY);
|
|
37 |
aGc->DrawRect(TRect(drawBase,drawBase+drawSize));
|
|
38 |
TPoint offset=drawBase+aOffset;
|
|
39 |
aGc->SetPenColor(TRgb::Gray4(2));
|
|
40 |
// aGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
|
|
41 |
aGc->DrawRect(TRect(offset+TPoint(13,23),offset+TPoint(22,32)));
|
|
42 |
TInt xpos,xplus;
|
|
43 |
for(xpos=0,xplus=2;xpos<drawSize.iWidth;xplus+=2,xpos+=xplus)
|
|
44 |
aGc->DrawLine(TPoint(xpos,0)+offset,TPoint(xpos,drawSize.iHeight)+offset);
|
|
45 |
for(TInt ypos=0,yplus=2;ypos<drawSize.iHeight;yplus+=2,ypos+=yplus)
|
|
46 |
aGc->DrawLine(TPoint(0,ypos)+offset,TPoint(drawSize.iWidth,ypos)+offset);
|
|
47 |
//
|
|
48 |
aGc->SetPenColor(TRgb(0,0,0));
|
|
49 |
aGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
|
|
50 |
TheClient->iWs.Flush();
|
|
51 |
for(xpos=0;xpos<drawSize.iWidth;xpos+=16)
|
|
52 |
{
|
|
53 |
aGc->DrawLine(TPoint(xpos,0)+offset,TPoint(drawSize.iWidth,xpos*drawSize.iHeight/drawSize.iWidth)+offset);
|
|
54 |
aGc->DrawLine(TPoint(xpos,0)+offset,TPoint(0,drawSize.iHeight-xpos*drawSize.iHeight/drawSize.iWidth)+offset);
|
|
55 |
aGc->DrawLine(TPoint(xpos,drawSize.iHeight)+offset,TPoint(drawSize.iWidth,drawSize.iHeight-xpos*drawSize.iHeight/drawSize.iWidth)+offset);
|
|
56 |
aGc->DrawLine(TPoint(xpos,drawSize.iHeight)+offset,TPoint(0,xpos*drawSize.iHeight/drawSize.iWidth)+offset);
|
|
57 |
}
|
|
58 |
|
|
59 |
}
|
|
60 |
|
|
61 |
CScrollWindowNorm::CScrollWindowNorm() : CTWin()
|
|
62 |
{
|
|
63 |
}
|
|
64 |
|
|
65 |
void DrawScrollWin(const TPoint &aOffset, const TSize &aSize)
|
|
66 |
{
|
|
67 |
::DrawScrollWin(TheClient->iGc, aOffset, aSize);
|
|
68 |
}
|
|
69 |
|
|
70 |
void CScrollWindowNorm::Draw()
|
|
71 |
{
|
|
72 |
DrawScrollWin(iScrollTest->Offset(), Size());
|
|
73 |
}
|
|
74 |
|
|
75 |
void CScrollWindowNorm::SetScrollTest(CScrollTestBase *aScrollTest)
|
|
76 |
{
|
|
77 |
iScrollTest=aScrollTest;
|
|
78 |
}
|
|
79 |
|
|
80 |
//
|
|
81 |
// CScrollWindowBackedUp
|
|
82 |
//
|
|
83 |
|
|
84 |
CScrollWindowBackedUp::CScrollWindowBackedUp(TDisplayMode aDisplayMode) : CTBackedUpWin(aDisplayMode)
|
|
85 |
{
|
|
86 |
}
|
|
87 |
|
|
88 |
void CScrollWindowBackedUp::Draw()
|
|
89 |
{
|
|
90 |
DrawScrollWin(iScrollTest->Offset(), Size());
|
|
91 |
}
|
|
92 |
|
|
93 |
void CScrollWindowBackedUp::SetScrollTest(CScrollTestBase *aScrollTest)
|
|
94 |
{
|
|
95 |
iScrollTest=aScrollTest;
|
|
96 |
}
|
|
97 |
|
|
98 |
//
|
|
99 |
// CScrollTestBase
|
|
100 |
//
|
|
101 |
|
|
102 |
void CScrollTestBase::Reset()
|
|
103 |
{
|
|
104 |
iOffset=TPoint(0,0);
|
|
105 |
iInvalid.Clear();
|
|
106 |
}
|
|
107 |
|
|
108 |
void CScrollTestBase::DoInvalidate()
|
|
109 |
{
|
|
110 |
}
|
|
111 |
|
|
112 |
TPoint CScrollTestBase::Offset() const
|
|
113 |
{
|
|
114 |
return(iOffset);
|
|
115 |
}
|
|
116 |
|
|
117 |
CScrollTestBase::~CScrollTestBase()
|
|
118 |
{
|
|
119 |
delete iBlankWin;
|
|
120 |
iInvalid.Close();
|
|
121 |
}
|
|
122 |
|
|
123 |
void CScrollTestBaseNorm::ConstructL(const TPoint &aPos, const TSize &aSize)
|
|
124 |
{
|
|
125 |
iScrollWin=new(ELeave) CScrollWindowNorm();
|
|
126 |
iScrollWin->SetUpL(aPos, aSize, TheClient->iGroup, *TheClient->iGc);
|
|
127 |
iScrollWin->SetScrollTest(this);
|
|
128 |
iSize=iScrollWin->Size();
|
|
129 |
}
|
|
130 |
|
|
131 |
CScrollTestBaseNorm::~CScrollTestBaseNorm()
|
|
132 |
{
|
|
133 |
delete iScrollWin;
|
|
134 |
}
|
|
135 |
|
|
136 |
void CScrollTestBaseNorm::Redraw()
|
|
137 |
{
|
|
138 |
iScrollWin->Redraw();
|
|
139 |
}
|
|
140 |
|
|
141 |
void CScrollTestBaseNorm::Reset()
|
|
142 |
{
|
|
143 |
iScrollWin->Win()->Invalidate();
|
|
144 |
iScrollWin->Redraw();
|
|
145 |
CScrollTestBase::Reset();
|
|
146 |
}
|
|
147 |
|
|
148 |
CTDrawableWin *CScrollTestBaseNorm::ScrollWin() const
|
|
149 |
{
|
|
150 |
return(iScrollWin);
|
|
151 |
}
|
|
152 |
|
|
153 |
void CScrollTestBaseNorm::AdjustTestScrollRegion(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)
|
|
154 |
{
|
|
155 |
RRegion clipped_visible;
|
|
156 |
VisibleRegion(clipped_visible);
|
|
157 |
clipped_visible.ClipRect(aClipRect);
|
|
158 |
//
|
|
159 |
//
|
|
160 |
RRegion invalidate(aRect);
|
|
161 |
invalidate.SubRegion(clipped_visible);
|
|
162 |
invalidate.Offset(aOffset);
|
|
163 |
invalidate.ClipRect(aClipRect);
|
|
164 |
//
|
|
165 |
RRegion invalidate2(aRect);
|
|
166 |
invalidate2.ClipRect(aClipRect);
|
|
167 |
invalidate2.Intersect(iInvalid);
|
|
168 |
invalidate2.Offset(aOffset);
|
|
169 |
invalidate2.ClipRect(aClipRect);
|
|
170 |
//
|
|
171 |
RRegion validate(aRect);
|
|
172 |
validate.Intersect(clipped_visible);
|
|
173 |
validate.SubRegion(iInvalid);
|
|
174 |
validate.Offset(aOffset);
|
|
175 |
validate.ClipRect(aClipRect);
|
|
176 |
//
|
|
177 |
iInvalid.SubRegion(validate);
|
|
178 |
iInvalid.Union(invalidate);
|
|
179 |
iInvalid.Union(invalidate2);
|
|
180 |
RRegion visible;
|
|
181 |
VisibleRegion(visible);
|
|
182 |
iInvalid.Intersect(visible);
|
|
183 |
iInvalid.Tidy();
|
|
184 |
//
|
|
185 |
invalidate2.Close();
|
|
186 |
invalidate.Close();
|
|
187 |
validate.Close();
|
|
188 |
visible.Close();
|
|
189 |
clipped_visible.Close();
|
|
190 |
|
|
191 |
iOffset+=aOffset;
|
|
192 |
}
|
|
193 |
|
|
194 |
void CScrollTestBaseNorm::VisibleRegion(RRegion &aRegion)
|
|
195 |
{
|
|
196 |
aRegion.Clear();
|
|
197 |
aRegion.AddRect(TRect(iSize));
|
|
198 |
TRect child;
|
|
199 |
child.iTl=iBlankWin->BaseWin()->InquireOffset(*ScrollWin()->BaseWin());
|
|
200 |
child.iBr=child.iTl+iBlankWin->BaseWin()->Size();
|
|
201 |
aRegion.SubRect(child);
|
|
202 |
}
|
|
203 |
|
|
204 |
void CScrollWindow1::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)
|
|
205 |
{
|
|
206 |
TheGc->Activate(*iScrollWin->DrawableWin());
|
|
207 |
RRegion region(aRect);
|
|
208 |
RRegion visible;
|
|
209 |
VisibleRegion(visible);
|
|
210 |
visible.ClipRect(aClipRect);
|
|
211 |
region.Intersect(visible);
|
|
212 |
visible.Close();
|
|
213 |
region.SubRegion(iInvalid);
|
|
214 |
region.Offset(aOffset);
|
|
215 |
region.ClipRect(aClipRect);
|
|
216 |
TheGc->SetClippingRegion(region);
|
|
217 |
TheGc->CopyRect(aOffset,aRect);
|
|
218 |
TheGc->Deactivate();
|
|
219 |
AdjustTestScrollRegion(aClipRect, aOffset,aRect);
|
|
220 |
iInvalid.Union(TRegionFix<1>(TRect(aClipRect)));
|
|
221 |
region.Close();
|
|
222 |
}
|
|
223 |
|
|
224 |
void CScrollWindow1::DoTestScroll(const TPoint &aOffset)
|
|
225 |
{
|
|
226 |
DoTestScroll(TRect(TPoint(0,0),iSize), aOffset,TRect(-aOffset,iSize));
|
|
227 |
}
|
|
228 |
|
|
229 |
void CScrollWindow1::DoTestScroll(const TPoint &aOffset, const TRect &aRect)
|
|
230 |
{
|
|
231 |
DoTestScroll(TRect(TPoint(0,0),iSize), aOffset, aRect);
|
|
232 |
}
|
|
233 |
|
|
234 |
void CScrollWindow1::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset)
|
|
235 |
{
|
|
236 |
DoTestScroll(aClipRect, aOffset, TRect(-aOffset.iX,-aOffset.iY,iSize.iWidth-aOffset.iX, iSize.iHeight-aOffset.iY));
|
|
237 |
}
|
|
238 |
|
|
239 |
void CScrollWindow1::DoInvalidate()
|
|
240 |
{
|
|
241 |
for(TInt index=0;index<iInvalid.Count();index++)
|
|
242 |
iScrollWin->Invalidate(iInvalid[index]);
|
|
243 |
}
|
|
244 |
|
|
245 |
void CScrollWindow2::Reset()
|
|
246 |
{
|
|
247 |
CScrollTestBaseNorm::Reset();
|
|
248 |
iClipped=EFalse;
|
|
249 |
}
|
|
250 |
|
|
251 |
CScrollWindow2::CScrollWindow2(CTScroll *aTest) : iTest(aTest)
|
|
252 |
{
|
|
253 |
}
|
|
254 |
|
|
255 |
void CScrollWindow2::Draw()
|
|
256 |
{
|
|
257 |
if (iClipped)
|
|
258 |
TheClient->iGc->SetClippingRegion(iInvalid);
|
|
259 |
iScrollWin->Draw();
|
|
260 |
if (iClipped)
|
|
261 |
TheClient->iGc->CancelClippingRegion();
|
|
262 |
}
|
|
263 |
|
|
264 |
void CScrollWindow2::DoTestScroll(const TPoint &aOffset)
|
|
265 |
{
|
|
266 |
AdjustTestScrollRegion(TRect(iSize), aOffset, TRect(-aOffset.iX,-aOffset.iY,iSize.iWidth-aOffset.iX, iSize.iHeight-aOffset.iY));
|
|
267 |
iClipped=ETrue;
|
|
268 |
iScrollWin->DrawableWin()->Scroll(aOffset);
|
|
269 |
}
|
|
270 |
|
|
271 |
void CScrollWindow2::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset)
|
|
272 |
{
|
|
273 |
AdjustTestScrollRegion(aClipRect, aOffset, TRect(-aOffset.iX,-aOffset.iY,iSize.iWidth-aOffset.iX, iSize.iHeight-aOffset.iY));
|
|
274 |
iClipped=ETrue;
|
|
275 |
iScrollWin->DrawableWin()->Scroll(aClipRect, aOffset);
|
|
276 |
}
|
|
277 |
|
|
278 |
void CScrollWindow2::DoTestScroll(const TPoint &aOffset, const TRect &aRect)
|
|
279 |
{
|
|
280 |
AdjustTestScrollRegion(TRect(iSize), aOffset, aRect);
|
|
281 |
iClipped=ETrue;
|
|
282 |
iScrollWin->DrawableWin()->Scroll(aOffset, aRect);
|
|
283 |
}
|
|
284 |
|
|
285 |
void CScrollWindow2::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)
|
|
286 |
{
|
|
287 |
AdjustTestScrollRegion(aClipRect, aOffset, aRect);
|
|
288 |
iClipped=ETrue;
|
|
289 |
iScrollWin->DrawableWin()->Scroll(aClipRect, aOffset, aRect);
|
|
290 |
}
|
|
291 |
|
|
292 |
void CScrollWindow3::DrawScrollBit()
|
|
293 |
{
|
|
294 |
::DrawScrollWin(iBitmapGc, iOffset, iSize);
|
|
295 |
}
|
|
296 |
|
|
297 |
void CScrollWindow3::Reset()
|
|
298 |
{
|
|
299 |
CScrollTestBase::Reset();
|
|
300 |
iBitmapGc->Clear(TRect(iSize));
|
|
301 |
DrawScrollBit();
|
|
302 |
DoInvalidate();
|
|
303 |
}
|
|
304 |
|
|
305 |
CScrollWindow3::~CScrollWindow3()
|
|
306 |
{
|
|
307 |
delete iBitmapGc;
|
|
308 |
delete iBitmapDevice;
|
|
309 |
delete iBitmap;
|
|
310 |
}
|
|
311 |
|
|
312 |
void CScrollWindow3::ConstructL(const TPoint &aPos, const TSize &aSize)
|
|
313 |
{
|
|
314 |
CScrollTestBaseNorm::ConstructL(aPos,aSize);
|
|
315 |
iBitmap=new(ELeave) CFbsBitmap();
|
|
316 |
User::LeaveIfError(iBitmap->Create(iSize,EGray4));
|
|
317 |
iBitmapDevice=CFbsBitmapDevice::NewL(iBitmap);
|
|
318 |
User::LeaveIfError(iBitmapDevice->CreateContext(iBitmapGc));
|
|
319 |
DrawScrollBit();
|
|
320 |
}
|
|
321 |
|
|
322 |
void CScrollWindow3::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)
|
|
323 |
{
|
|
324 |
iOffset+=aOffset;
|
|
325 |
RRegion blank(aRect);
|
|
326 |
TRect clipRect(aClipRect);
|
|
327 |
clipRect.Intersection(TRect(iSize));
|
|
328 |
blank.SubRect(clipRect);
|
|
329 |
blank.Offset(aOffset);
|
|
330 |
blank.ClipRect(clipRect);
|
|
331 |
TRect rect(aRect);
|
|
332 |
rect.Intersection(clipRect);
|
|
333 |
TRect rect2(clipRect);
|
|
334 |
rect2.Move(-aOffset);
|
|
335 |
rect.Intersection(rect2);
|
|
336 |
iBitmapGc->CopyRect(aOffset,rect);
|
|
337 |
iBitmapGc->SetClippingRegion(&blank);
|
|
338 |
iBitmapGc->Clear(TRect(iSize));
|
|
339 |
iBitmapGc->SetClippingRegion(NULL);
|
|
340 |
blank.Close();
|
|
341 |
}
|
|
342 |
|
|
343 |
void CScrollWindow3::DoTestScroll(const TPoint &aOffset)
|
|
344 |
{
|
|
345 |
DoTestScroll(TRect(iSize), aOffset,TRect(-aOffset.iX,-aOffset.iY,iSize.iWidth-aOffset.iX, iSize.iHeight-aOffset.iY));
|
|
346 |
}
|
|
347 |
|
|
348 |
void CScrollWindow3::DoTestScroll(const TPoint &aOffset, const TRect &aRect)
|
|
349 |
{
|
|
350 |
DoTestScroll(TRect(iSize), aOffset, aRect);
|
|
351 |
}
|
|
352 |
|
|
353 |
void CScrollWindow3::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset)
|
|
354 |
{
|
|
355 |
DoTestScroll(aClipRect, aOffset, TRect(-aOffset.iX,-aOffset.iY,iSize.iWidth-aOffset.iX, iSize.iHeight-aOffset.iY));
|
|
356 |
}
|
|
357 |
|
|
358 |
void CScrollWindow3::Draw()
|
|
359 |
{
|
|
360 |
TheGc->BitBlt(TPoint(),iBitmap);
|
|
361 |
}
|
|
362 |
|
|
363 |
void CScrollWindow3::DoInvalidate()
|
|
364 |
{
|
|
365 |
RWindow win=*iScrollWin->Win();
|
|
366 |
win.Invalidate();
|
|
367 |
win.BeginRedraw();
|
|
368 |
TheGc->Activate(win);
|
|
369 |
Draw();
|
|
370 |
TheGc->Deactivate();
|
|
371 |
win.EndRedraw();
|
|
372 |
}
|
|
373 |
|
|
374 |
void CScrollWindow4::ConstructL(const TPoint &aPos, const TSize &aSize)
|
|
375 |
{
|
|
376 |
iScrollWin=new(ELeave) CScrollWindowBackedUp(EGray4);
|
|
377 |
iScrollWin->SetUpL(aPos, aSize, TheClient->iGroup, *TheClient->iGc);
|
|
378 |
iScrollWin->SetScrollTest(this);
|
|
379 |
iSize=iScrollWin->Size();
|
|
380 |
TheClient->iGc->Activate(*iScrollWin->DrawableWin());
|
|
381 |
TheClient->iGc->Clear();
|
|
382 |
DrawScrollWin(TPoint(), iSize);
|
|
383 |
TheClient->iGc->Deactivate();
|
|
384 |
}
|
|
385 |
|
|
386 |
CScrollWindow4::~CScrollWindow4()
|
|
387 |
{
|
|
388 |
delete iScrollWin;
|
|
389 |
}
|
|
390 |
|
|
391 |
void CScrollWindow4::Redraw()
|
|
392 |
{
|
|
393 |
}
|
|
394 |
|
|
395 |
void CScrollWindow4::Reset()
|
|
396 |
{
|
|
397 |
TheClient->iGc->Activate(*iScrollWin->DrawableWin());
|
|
398 |
TheClient->iGc->Clear();
|
|
399 |
DrawScrollWin(TPoint(), iSize);
|
|
400 |
TheClient->iGc->Deactivate();
|
|
401 |
CScrollTestBase::Reset();
|
|
402 |
}
|
|
403 |
|
|
404 |
void CScrollWindow4::DoTestScroll(const TPoint &aOffset)
|
|
405 |
{
|
|
406 |
iScrollWin->DrawableWin()->Scroll(aOffset);
|
|
407 |
iOffset+=aOffset;
|
|
408 |
}
|
|
409 |
|
|
410 |
void CScrollWindow4::DoTestScroll(const TPoint &aOffset, const TRect &aRect)
|
|
411 |
{
|
|
412 |
iScrollWin->DrawableWin()->Scroll(aOffset, aRect);
|
|
413 |
iOffset+=aOffset;
|
|
414 |
}
|
|
415 |
|
|
416 |
void CScrollWindow4::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset)
|
|
417 |
{
|
|
418 |
iScrollWin->DrawableWin()->Scroll(aClipRect, aOffset);
|
|
419 |
iOffset+=aOffset;
|
|
420 |
}
|
|
421 |
|
|
422 |
void CScrollWindow4::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)
|
|
423 |
{
|
|
424 |
iScrollWin->DrawableWin()->Scroll(aClipRect, aOffset, aRect);
|
|
425 |
iOffset+=aOffset;
|
|
426 |
}
|
|
427 |
|
|
428 |
CTDrawableWin *CScrollWindow4::ScrollWin() const
|
|
429 |
{
|
|
430 |
return(iScrollWin);
|
|
431 |
}
|
|
432 |
|
|
433 |
//
|
|
434 |
|
|
435 |
CTScroll::CTScroll(CTestStep* aStep):
|
|
436 |
CTWsGraphicsBase(aStep)
|
|
437 |
{
|
|
438 |
}
|
|
439 |
|
|
440 |
CTScroll::~CTScroll()
|
|
441 |
{
|
|
442 |
BaseWin->SetVisible(ETrue);
|
|
443 |
TestWin->SetVisible(ETrue);
|
|
444 |
delete iBaseScrollWin;
|
|
445 |
delete iTestScrollWin;
|
|
446 |
}
|
|
447 |
|
|
448 |
void CTScroll::ConstructL()
|
|
449 |
{
|
|
450 |
BaseWin->SetVisible(EFalse);
|
|
451 |
TestWin->SetVisible(EFalse);
|
|
452 |
//
|
|
453 |
iTest->iState=1;
|
|
454 |
TSize screenSize=TheClient->iGroup->Size();
|
|
455 |
TInt winWidth=(screenSize.iWidth/3)-10;
|
|
456 |
TInt winHeight=screenSize.iHeight-10;
|
|
457 |
TInt winBaseX=(screenSize.iWidth/3);
|
|
458 |
if (iMode==0)
|
|
459 |
{
|
|
460 |
iBaseScrollWin=new(ELeave) CScrollWindow1();
|
|
461 |
iTestScrollWin=new(ELeave) CScrollWindow2(this);
|
|
462 |
}
|
|
463 |
else
|
|
464 |
{
|
|
465 |
iBaseScrollWin=new(ELeave) CScrollWindow3();
|
|
466 |
iTestScrollWin=new(ELeave) CScrollWindow4();
|
|
467 |
}
|
|
468 |
iWinSize=TSize(winWidth,winHeight);
|
|
469 |
iBaseScrollWin->ConstructL(TPoint(winBaseX+5,5),iWinSize);
|
|
470 |
iTestScrollWin->ConstructL(TPoint(winBaseX+winWidth+15,5),iWinSize);
|
|
471 |
|
|
472 |
iBaseScrollWin->iBlankWin=new(ELeave) CTBlankWindow();
|
|
473 |
iBaseScrollWin->iBlankWin->SetUpL(iBaseScrollWin->ScrollWin()->BaseWin()->InquireOffset(*TheClient->iGroup->GroupWin())+TPoint(winWidth>>2,winHeight>>2),TSize(winWidth>>2,winHeight>>1),TheClient->iGroup,*TheClient->iGc);
|
|
474 |
iBaseScrollWin->iBlankWin->BlankWin()->SetShadowHeight(2);
|
|
475 |
|
|
476 |
iTestScrollWin->iBlankWin=new(ELeave) CTBlankWindow();
|
|
477 |
iTestScrollWin->iBlankWin->SetUpL(iTestScrollWin->ScrollWin()->BaseWin()->InquireOffset(*TheClient->iGroup->GroupWin())+TPoint(winWidth>>2,winHeight>>2),TSize(winWidth>>2,winHeight>>1),TheClient->iGroup,*TheClient->iGc);
|
|
478 |
}
|
|
479 |
|
|
480 |
void CTScroll::CheckScrollWindows()
|
|
481 |
{
|
|
482 |
CheckRect(iBaseScrollWin->ScrollWin(),iTestScrollWin->ScrollWin(),TRect(iBaseScrollWin->ScrollWin()->Size()),_L("CTScroll::CheckScrollWindows()"));
|
|
483 |
}
|
|
484 |
|
|
485 |
void CTScroll::DoTestScroll(const TPoint &aOffset)
|
|
486 |
{
|
|
487 |
iTestScrollWin->DoTestScroll(aOffset);
|
|
488 |
iBaseScrollWin->DoTestScroll(aOffset);
|
|
489 |
}
|
|
490 |
|
|
491 |
void CTScroll::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset)
|
|
492 |
{
|
|
493 |
iTestScrollWin->DoTestScroll(aClipRect,aOffset);
|
|
494 |
iBaseScrollWin->DoTestScroll(aClipRect,aOffset);
|
|
495 |
}
|
|
496 |
|
|
497 |
void CTScroll::DoTestScroll(const TPoint &aOffset, const TRect &aRect)
|
|
498 |
{
|
|
499 |
iTestScrollWin->DoTestScroll(aOffset,aRect);
|
|
500 |
iBaseScrollWin->DoTestScroll(aOffset,aRect);
|
|
501 |
}
|
|
502 |
|
|
503 |
void CTScroll::DoTestScroll(const TRect &aClipRect, const TPoint &aOffset, const TRect &aRect)
|
|
504 |
{
|
|
505 |
iTestScrollWin->DoTestScroll(aClipRect,aOffset,aRect);
|
|
506 |
iBaseScrollWin->DoTestScroll(aClipRect,aOffset,aRect);
|
|
507 |
}
|
|
508 |
|
|
509 |
void CTScroll::FinishedRectScrolls()
|
|
510 |
{
|
|
511 |
iBaseScrollWin->DoInvalidate();
|
|
512 |
}
|
|
513 |
|
|
514 |
void CTScroll::CheckOomScroll()
|
|
515 |
{
|
|
516 |
TheClient->iWs.HeapSetFail(RHeap::ENone,0);
|
|
517 |
FinishedRectScrolls();
|
|
518 |
iTestScrollWin->Redraw();
|
|
519 |
iBaseScrollWin->Redraw();
|
|
520 |
// if (iMode!=1) // Out of memory scrolling of backed up windows can not work 100% when out of memory
|
|
521 |
// CheckScrollWindows(); // Redraw window code can't check these cases properly yet
|
|
522 |
}
|
|
523 |
|
|
524 |
void CTScroll::OomScrolling()
|
|
525 |
{
|
|
526 |
iTestScrollWin->iBlankWin->BaseWin()->SetShadowHeight(0);
|
|
527 |
iBaseScrollWin->iBlankWin->BaseWin()->SetShadowHeight(0);
|
|
528 |
iTestScrollWin->ScrollWin()->BaseWin()->SetShadowHeight(0);
|
|
529 |
iTestScrollWin->Redraw();
|
|
530 |
iBaseScrollWin->Redraw();
|
|
531 |
for(TInt count=1;count<20;count++)
|
|
532 |
{
|
|
533 |
TheClient->iWs.HeapSetFail(RHeap::EDeterministic,count);
|
|
534 |
DoTestScroll(TPoint(50,0));
|
|
535 |
CheckOomScroll();
|
|
536 |
//
|
|
537 |
TheClient->iWs.HeapSetFail(RHeap::EDeterministic,count);
|
|
538 |
iTestScrollWin->Reset();
|
|
539 |
iBaseScrollWin->Reset();
|
|
540 |
DoTestScroll(TPoint(-6,-14),TRect(20,20,100,50));
|
|
541 |
CheckOomScroll();
|
|
542 |
//
|
|
543 |
TheClient->iWs.HeapSetFail(RHeap::EDeterministic,count);
|
|
544 |
iTestScrollWin->Reset();
|
|
545 |
iBaseScrollWin->Reset();
|
|
546 |
DoTestScroll(TRect(TPoint(1,1),iWinSize-TSize(1,1)),TPoint(50,0),TRect(10,10,50,50));
|
|
547 |
CheckOomScroll();
|
|
548 |
}
|
|
549 |
}
|
|
550 |
|
|
551 |
void CTScroll::RunTestCaseL(TInt /*aCurTestCase*/)
|
|
552 |
{
|
|
553 |
_LIT(KScroll,"Scroll");
|
|
554 |
//if (iTest->iState==0) iTest->iState=22;
|
|
555 |
if (iDoCheck)
|
|
556 |
{
|
|
557 |
if (iMode==1) // The test code does not mimic scrolling to a non-backed up window properly
|
|
558 |
{
|
|
559 |
TheClient->iWs.Flush();
|
|
560 |
TheClient->iWs.Finish();
|
|
561 |
CheckScrollWindows();
|
|
562 |
}
|
|
563 |
iTestScrollWin->Reset();
|
|
564 |
iBaseScrollWin->Reset();
|
|
565 |
TheClient->iWs.Flush();
|
|
566 |
++iTest->iState;
|
|
567 |
iDoCheck=EFalse;
|
|
568 |
return;
|
|
569 |
}
|
|
570 |
((CTScrollStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
|
571 |
switch(iTest->iState)
|
|
572 |
{
|
|
573 |
/**
|
|
574 |
@SYMTestCaseID GRAPHICS-WSERV-0249
|
|
575 |
|
|
576 |
@SYMDEF DEF081259
|
|
577 |
|
|
578 |
@SYMTestCaseDesc Test window scrolling by different offsets
|
|
579 |
|
|
580 |
@SYMTestPriority High
|
|
581 |
|
|
582 |
@SYMTestStatus Implemented
|
|
583 |
|
|
584 |
@SYMTestActions Pass different offsets for scrolling a window by and
|
|
585 |
check the window is scrolled correctly
|
|
586 |
|
|
587 |
@SYMTestExpectedResults Window scrolls correctly to offsets
|
|
588 |
*/
|
|
589 |
case 1:
|
|
590 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
591 |
//DemoWindowScroll();
|
|
592 |
iTest->LogSubTest(KScroll);
|
|
593 |
DoTestScroll(TPoint(6,0));
|
|
594 |
DoTestScroll(TPoint(-6,-14));
|
|
595 |
DoTestScroll(TPoint(-6,-14));
|
|
596 |
DoTestScroll(TPoint(0,10));
|
|
597 |
DoTestScroll(TPoint(0,0));
|
|
598 |
DoTestScroll(TPoint(10,23));
|
|
599 |
break;
|
|
600 |
case 2:
|
|
601 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
602 |
iTest->LogSubTest(KScroll);
|
|
603 |
DoTestScroll(TPoint(50,0));
|
|
604 |
break;
|
|
605 |
case 3:
|
|
606 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
607 |
iTest->LogSubTest(KScroll);
|
|
608 |
DoTestScroll(TPoint(0,33));
|
|
609 |
break;
|
|
610 |
case 4:
|
|
611 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
612 |
iTest->LogSubTest(KScroll);
|
|
613 |
DoTestScroll(TPoint(-10,0));
|
|
614 |
break;
|
|
615 |
case 5:
|
|
616 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
617 |
iTest->LogSubTest(KScroll);
|
|
618 |
DoTestScroll(TPoint(0,-13));
|
|
619 |
break;
|
|
620 |
case 6:
|
|
621 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
622 |
iTest->LogSubTest(KScroll);
|
|
623 |
DoTestScroll(TPoint(0,0));
|
|
624 |
break;
|
|
625 |
case 7:
|
|
626 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
627 |
iTest->LogSubTest(KScroll);
|
|
628 |
DoTestScroll(TPoint(-234,-1400));
|
|
629 |
break;
|
|
630 |
case 8:
|
|
631 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
632 |
iTest->LogSubTest(KScroll);
|
|
633 |
DoTestScroll(TPoint(-69,15));
|
|
634 |
break;
|
|
635 |
case 9:
|
|
636 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
637 |
iTest->LogSubTest(KScroll);
|
|
638 |
DoTestScroll(TPoint(-234,-1400));
|
|
639 |
DoTestScroll(TPoint(233,1401));
|
|
640 |
break;
|
|
641 |
case 10:
|
|
642 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0249"));
|
|
643 |
iTest->LogSubTest(KScroll);
|
|
644 |
DoTestScroll(TPoint(10,-1));
|
|
645 |
DoTestScroll(TPoint(11,-10));
|
|
646 |
DoTestScroll(TPoint(-5,-40));
|
|
647 |
DoTestScroll(TPoint(0,50));
|
|
648 |
break;
|
|
649 |
|
|
650 |
/**
|
|
651 |
@SYMTestCaseID GRAPHICS-WSERV-0250
|
|
652 |
|
|
653 |
@SYMDEF DEF081259
|
|
654 |
|
|
655 |
@SYMTestCaseDesc Test window scrolling by different offsets and
|
|
656 |
source rectangles
|
|
657 |
|
|
658 |
@SYMTestPriority High
|
|
659 |
|
|
660 |
@SYMTestStatus Implemented
|
|
661 |
|
|
662 |
@SYMTestActions Pass different offsets for scroll a window by and
|
|
663 |
different source rectangles.
|
|
664 |
Check the window is scrolled correctly
|
|
665 |
|
|
666 |
@SYMTestExpectedResults Window scrolls correctly to offsets and source
|
|
667 |
rectangles
|
|
668 |
*/
|
|
669 |
case 11:
|
|
670 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0250"));
|
|
671 |
iTest->LogSubTest(KScroll);
|
|
672 |
DoTestScroll(TPoint(-6,-14),TRect(20,20,100,50));
|
|
673 |
DoTestScroll(TPoint(-6,-14),TRect(20,20,100,50));
|
|
674 |
DoTestScroll(TPoint(-6,-14),TRect(40,10,130,130));
|
|
675 |
break;
|
|
676 |
case 12:
|
|
677 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0250"));
|
|
678 |
iTest->LogSubTest(KScroll);
|
|
679 |
DoTestScroll(TPoint(10,-1),TRect(20,20,21,21));
|
|
680 |
break;
|
|
681 |
case 13:
|
|
682 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0250"));
|
|
683 |
iTest->LogSubTest(KScroll);
|
|
684 |
DoTestScroll(TPoint(-20,-14),TRect(10,10,10,10));
|
|
685 |
break;
|
|
686 |
case 14:
|
|
687 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0250"));
|
|
688 |
iTest->LogSubTest(KScroll);
|
|
689 |
DoTestScroll(TPoint(-6,-14),TRect(20,20,200,300));
|
|
690 |
DoTestScroll(TPoint(10,-24),TRect(20,20,200,300));
|
|
691 |
DoTestScroll(TPoint(3,12),TRect(20,20,200,300));
|
|
692 |
DoTestScroll(TPoint(-20,19),TRect(20,20,200,300));
|
|
693 |
break;
|
|
694 |
case 15:
|
|
695 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0250"));
|
|
696 |
iTest->LogSubTest(KScroll);
|
|
697 |
DoTestScroll(TPoint(-6,-14),TRect(20000,200000,30000,300000));
|
|
698 |
DoTestScroll(TPoint(10,-24),TRect(20,20,-200,-300));
|
|
699 |
DoTestScroll(TPoint(10,-24),TRect(20,20,-200,300));
|
|
700 |
DoTestScroll(TPoint(10,-24),TRect(20,20,200,-300));
|
|
701 |
DoTestScroll(TPoint(3,12),TRect(-100,-200,1000,2000));
|
|
702 |
DoTestScroll(TPoint(-20,19),TRect(0,0,0,0));
|
|
703 |
break;
|
|
704 |
|
|
705 |
/**
|
|
706 |
@SYMTestCaseID GRAPHICS-WSERV-0251
|
|
707 |
|
|
708 |
@SYMDEF DEF081259
|
|
709 |
|
|
710 |
@SYMTestCaseDesc Test window scrolling by different offsets and
|
|
711 |
clipping rectangles
|
|
712 |
|
|
713 |
@SYMTestPriority High
|
|
714 |
|
|
715 |
@SYMTestStatus Implemented
|
|
716 |
|
|
717 |
@SYMTestActions Pass different offsets for scroll a window by and
|
|
718 |
different clipping rectangles.
|
|
719 |
Check the window is scrolled correctly
|
|
720 |
|
|
721 |
@SYMTestExpectedResults Window scrolls correctly to offsets and clipping
|
|
722 |
rectangles
|
|
723 |
*/
|
|
724 |
case 16:
|
|
725 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0251"));
|
|
726 |
iTest->LogSubTest(KScroll);
|
|
727 |
DoTestScroll(TRect(10,10,200,200),TPoint(-6,-14));
|
|
728 |
break;
|
|
729 |
case 17:
|
|
730 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0251"));
|
|
731 |
iTest->LogSubTest(KScroll);
|
|
732 |
DoTestScroll(TRect(10,50,210,200),TPoint(10,20));
|
|
733 |
DoTestScroll(TRect(0,0,100,100),TPoint(-22,4));
|
|
734 |
DoTestScroll(TRect(50,50,300,500),TPoint(-5,-2));
|
|
735 |
break;
|
|
736 |
case 18:
|
|
737 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0251"));
|
|
738 |
iTest->LogSubTest(KScroll);
|
|
739 |
DoTestScroll(TRect(-1000,-10000,23456,1111),TPoint(-6,-14));
|
|
740 |
break;
|
|
741 |
case 19:
|
|
742 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0251"));
|
|
743 |
iTest->LogSubTest(KScroll);
|
|
744 |
DoTestScroll(TRect(20,5,198,202),TPoint(-100,1));
|
|
745 |
DoTestScroll(TRect(1,1,200,123),TPoint(2,1));
|
|
746 |
DoTestScroll(TRect(23,23,200,400),TPoint(5,-1));
|
|
747 |
break;
|
|
748 |
case 20:
|
|
749 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0251"));
|
|
750 |
iTest->LogSubTest(KScroll);
|
|
751 |
DoTestScroll(TRect(0,0,0,0),TPoint(-10,1));
|
|
752 |
DoTestScroll(TRect(-1000,1,2000,123),TPoint(2,1));
|
|
753 |
DoTestScroll(TRect(23,-23,200,40000),TPoint(5,-1));
|
|
754 |
DoTestScroll(TRect(-1000,-10000,23456,1111),TPoint(-6,-14));
|
|
755 |
break;
|
|
756 |
|
|
757 |
/**
|
|
758 |
@SYMTestCaseID GRAPHICS-WSERV-0252
|
|
759 |
|
|
760 |
@SYMDEF DEF081259
|
|
761 |
|
|
762 |
@SYMTestCaseDesc Test window scrolling by different offsets and
|
|
763 |
clipping ans source rectangles
|
|
764 |
|
|
765 |
@SYMTestPriority High
|
|
766 |
|
|
767 |
@SYMTestStatus Implemented
|
|
768 |
|
|
769 |
@SYMTestActions Pass different offsets for scroll a window by and
|
|
770 |
different clipping and source rectangles.
|
|
771 |
Check the window is scrolled correctly
|
|
772 |
|
|
773 |
@SYMTestExpectedResults Window scrolls correctly to offsets and source
|
|
774 |
and clipping rectangles
|
|
775 |
*/
|
|
776 |
case 21:
|
|
777 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0252"));
|
|
778 |
iTest->LogSubTest(KScroll);
|
|
779 |
DoTestScroll(TRect(TPoint(1,1),iWinSize-TSize(1,1)),TPoint(-6,-14),TRect(10,10,50,50));
|
|
780 |
DoTestScroll(TRect(TPoint(1,1),iWinSize-TSize(1,1)),TPoint(16,4),TRect(10,10,50,50));
|
|
781 |
break;
|
|
782 |
case 22:
|
|
783 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0252"));
|
|
784 |
iTest->LogSubTest(KScroll);
|
|
785 |
DoTestScroll(TRect(TPoint(10,100),iWinSize-TSize(0,10)),TPoint(26,22),TRect(iWinSize));
|
|
786 |
DoTestScroll(TRect(iWinSize),TPoint(2,-1),TRect(-10,-10,50,50));
|
|
787 |
break;
|
|
788 |
/**
|
|
789 |
@SYMTestCaseID GRAPHICS-WSERV-0253
|
|
790 |
|
|
791 |
@SYMDEF DEF081259
|
|
792 |
|
|
793 |
@SYMTestCaseDesc Out of memory window scrolling test
|
|
794 |
|
|
795 |
@SYMTestPriority High
|
|
796 |
|
|
797 |
@SYMTestStatus Implemented
|
|
798 |
|
|
799 |
@SYMTestActions Out of memory window scrolling test
|
|
800 |
|
|
801 |
@SYMTestExpectedResults Out of memory scrolling is handled correctly
|
|
802 |
*/
|
|
803 |
case 23:
|
|
804 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0253"));
|
|
805 |
iTest->LogSubTest(KScroll);
|
|
806 |
OomScrolling();
|
|
807 |
iTest->CloseAllPanicWindows();
|
|
808 |
++iTest->iState;
|
|
809 |
return;
|
|
810 |
case 24:
|
|
811 |
((CTScrollStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0253"));
|
|
812 |
++iTest->iState;
|
|
813 |
++iMode;
|
|
814 |
if (iMode==1)
|
|
815 |
{
|
|
816 |
delete iBaseScrollWin;
|
|
817 |
delete iTestScrollWin;
|
|
818 |
ConstructL();
|
|
819 |
}
|
|
820 |
return;
|
|
821 |
default:
|
|
822 |
((CTScrollStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
823 |
((CTScrollStep*)iStep)->CloseTMSGraphicsStep();
|
|
824 |
TestComplete();
|
|
825 |
break;
|
|
826 |
}
|
|
827 |
((CTScrollStep*)iStep)->RecordTestResultL();
|
|
828 |
FinishedRectScrolls();
|
|
829 |
iDoCheck=ETrue;
|
|
830 |
}
|
|
831 |
|
|
832 |
void CTScroll::DemoWindowScrollL()
|
|
833 |
//Function to see what scrolling does.
|
|
834 |
{
|
|
835 |
CBlankWindow* iWin;
|
|
836 |
iWin=new(ELeave) CBlankWindow(TRgb(64,64,224));
|
|
837 |
iWin->SetUpL(TPoint(20,10),TSize(120,100),TheClient->iGroup,*TheClient->iGc);
|
|
838 |
iWin->BaseWin()->SetRequiredDisplayMode(EColor256);
|
|
839 |
iWin->Win()->SetBackgroundColor(TRgb(64,224,64));
|
|
840 |
iWin->RealDraw(ETrue);
|
|
841 |
TheClient->WaitForRedrawsToFinish();
|
|
842 |
iWin->DrawableWin()->Scroll(TPoint(8,5),TRect(20,20,100,80));
|
|
843 |
TheClient->Flush();
|
|
844 |
TheClient->WaitForRedrawsToFinish();
|
|
845 |
TheClient->Flush();
|
|
846 |
}
|
|
847 |
|
|
848 |
|
|
849 |
__WS_CONSTRUCT_STEP__(Scroll)
|
|
850 |
#pragma warning(default : 4710)
|