|
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 // General window tests |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 #include "twindowsizecache.h" |
|
25 |
|
26 CTWindowSizeCacheTest::CTWindowSizeCacheTest(CTestStep* aStep) : CTWsGraphicsBase(aStep) |
|
27 {} |
|
28 |
|
29 CTWindowSizeCacheTest::~CTWindowSizeCacheTest() |
|
30 { |
|
31 } |
|
32 |
|
33 void CTWindowSizeCacheTest::ConstructL() |
|
34 {} |
|
35 |
|
36 void CTWindowSizeCacheTest::TestCreateRWindowL(TSizeCacheStatus aEnableWindowSizeCache) |
|
37 { |
|
38 __UHEAP_MARK; |
|
39 // w* State Initial |
|
40 RWsSession rws; |
|
41 TInt err = rws.Connect(); |
|
42 CleanupClosePushL(rws); |
|
43 TEST(KErrNone == err); |
|
44 |
|
45 if (ETestSizeCacheEnabled == aEnableWindowSizeCache) |
|
46 { |
|
47 rws.EnableWindowSizeCacheL(); |
|
48 } |
|
49 |
|
50 RWindowGroup wg(rws); |
|
51 err = wg.Construct(0); |
|
52 CleanupClosePushL(wg); |
|
53 TEST(KErrNone == err); |
|
54 |
|
55 // w1 State 0 |
|
56 RWindow w1(rws); |
|
57 err = w1.Construct(wg,1); |
|
58 CleanupClosePushL(w1); |
|
59 TEST(KErrNone == err); |
|
60 |
|
61 // w2 State 0 |
|
62 RWindow w2(rws); |
|
63 err = w2.Construct(wg,2); |
|
64 CleanupClosePushL(w2); |
|
65 TEST(KErrNone == err); |
|
66 |
|
67 CleanupStack::Pop(2); |
|
68 |
|
69 // w1 State Final |
|
70 w1.Close(); |
|
71 // w2 State Final |
|
72 w2.Close(); |
|
73 |
|
74 RWindow w3(rws); |
|
75 // w3 State 0 |
|
76 err = w3.Construct(wg,1); |
|
77 CleanupClosePushL(w3); |
|
78 TEST(KErrNone == err); |
|
79 |
|
80 CleanupStack::Pop(2); |
|
81 |
|
82 // w3 State Final |
|
83 w3.Close(); |
|
84 |
|
85 wg.Close(); |
|
86 |
|
87 RWindowGroup wg2(rws); |
|
88 err = wg2.Construct(0); |
|
89 CleanupClosePushL(wg2); |
|
90 TEST(KErrNone == err); |
|
91 |
|
92 RWindowGroup wg3(rws); |
|
93 err = wg3.Construct(1); |
|
94 CleanupClosePushL(wg3); |
|
95 TEST(KErrNone == err); |
|
96 |
|
97 // w4 State 0 |
|
98 RWindow w4(rws); |
|
99 err = w4.Construct(wg2,2); |
|
100 CleanupClosePushL(w4); |
|
101 TEST(KErrNone == err); |
|
102 |
|
103 // w5 State 0 |
|
104 RWindow w5(rws); |
|
105 err = w5.Construct(wg3,3); |
|
106 CleanupClosePushL(w5); |
|
107 TEST(KErrNone == err); |
|
108 |
|
109 CleanupStack::Pop(5); |
|
110 |
|
111 // w4 State Final |
|
112 w4.Close(); |
|
113 |
|
114 // w5 State Final |
|
115 // Check nothing bad happens when calling Close more than once on RWindow |
|
116 w5.Close(); |
|
117 w5.Close(); |
|
118 |
|
119 // Check nothing bad happens when calling Close more than once on RWindowGroup |
|
120 wg2.Close(); |
|
121 wg2.Close(); |
|
122 |
|
123 wg3.Close(); |
|
124 |
|
125 // Check nothing bad happens when calling Close more than once on RWsSession |
|
126 rws.Close(); |
|
127 rws.Close(); |
|
128 __UHEAP_MARKEND; |
|
129 } |
|
130 |
|
131 void CTWindowSizeCacheTest::TestCreateRBlankWindowL(TSizeCacheStatus aEnableWindowSizeCache) |
|
132 { |
|
133 __UHEAP_MARK; |
|
134 // w* State Initial |
|
135 RWsSession rws; |
|
136 TInt err = rws.Connect(); |
|
137 CleanupClosePushL(rws); |
|
138 TEST(KErrNone == err); |
|
139 |
|
140 if (ETestSizeCacheEnabled == aEnableWindowSizeCache) |
|
141 { |
|
142 rws.EnableWindowSizeCacheL(); |
|
143 } |
|
144 |
|
145 RWindowGroup wg(rws); |
|
146 err = wg.Construct(0); |
|
147 CleanupClosePushL(wg); |
|
148 TEST(KErrNone == err); |
|
149 |
|
150 // w1 State 0 |
|
151 RBlankWindow w1(rws); |
|
152 err = w1.Construct(wg,1); |
|
153 CleanupClosePushL(w1); |
|
154 TEST(KErrNone == err); |
|
155 |
|
156 // w2 State 0 |
|
157 RBlankWindow w2(rws); |
|
158 err = w2.Construct(wg,2); |
|
159 CleanupClosePushL(w2); |
|
160 TEST(KErrNone == err); |
|
161 |
|
162 CleanupStack::Pop(2); |
|
163 |
|
164 // w1 State Final |
|
165 w1.Close(); |
|
166 // w2 State Final |
|
167 w2.Close(); |
|
168 |
|
169 RBlankWindow w3(rws); |
|
170 // w3 State 0 |
|
171 err = w3.Construct(wg,1); |
|
172 CleanupClosePushL(w3); |
|
173 TEST(KErrNone == err); |
|
174 |
|
175 CleanupStack::Pop(2); |
|
176 |
|
177 // w3 State Final |
|
178 w3.Close(); |
|
179 |
|
180 wg.Close(); |
|
181 |
|
182 RWindowGroup wg2(rws); |
|
183 err = wg2.Construct(0); |
|
184 CleanupClosePushL(wg2); |
|
185 TEST(KErrNone == err); |
|
186 |
|
187 RWindowGroup wg3(rws); |
|
188 err = wg3.Construct(1); |
|
189 CleanupClosePushL(wg3); |
|
190 TEST(KErrNone == err); |
|
191 |
|
192 // w4 State 0 |
|
193 RBlankWindow w4(rws); |
|
194 err = w4.Construct(wg2,2); |
|
195 CleanupClosePushL(w4); |
|
196 TEST(KErrNone == err); |
|
197 |
|
198 // w5 State 0 |
|
199 RBlankWindow w5(rws); |
|
200 err = w5.Construct(wg3,3); |
|
201 CleanupClosePushL(w5); |
|
202 TEST(KErrNone == err); |
|
203 |
|
204 CleanupStack::Pop(5); |
|
205 |
|
206 // w4 State Final |
|
207 w4.Close(); |
|
208 |
|
209 // w5 State Final |
|
210 // Check nothing bad happens when calling Close more than once on RBlankWindow |
|
211 w5.Close(); |
|
212 w5.Close(); |
|
213 |
|
214 wg2.Close(); |
|
215 wg3.Close(); |
|
216 rws.Close(); |
|
217 __UHEAP_MARKEND; |
|
218 } |
|
219 |
|
220 void CTWindowSizeCacheTest::TestCreateRBackedUpWindowL(TSizeCacheStatus aEnableWindowSizeCache, TDisplayMode aDisplayMode) |
|
221 { |
|
222 __UHEAP_MARK; |
|
223 // w* State Initial |
|
224 RWsSession rws; |
|
225 TInt err = rws.Connect(); |
|
226 CleanupClosePushL(rws); |
|
227 TEST(KErrNone == err); |
|
228 |
|
229 if (ETestSizeCacheEnabled == aEnableWindowSizeCache) |
|
230 { |
|
231 rws.EnableWindowSizeCacheL(); |
|
232 } |
|
233 |
|
234 RWindowGroup wg(rws); |
|
235 err = wg.Construct(0); |
|
236 CleanupClosePushL(wg); |
|
237 TEST(KErrNone == err); |
|
238 |
|
239 // w1 State 0 |
|
240 RBackedUpWindow w1(rws); |
|
241 err = w1.Construct(wg,aDisplayMode,1); |
|
242 CleanupClosePushL(w1); |
|
243 TEST(KErrNone == err); |
|
244 |
|
245 // w2 State 0 |
|
246 RBackedUpWindow w2(rws); |
|
247 err = w2.Construct(wg,aDisplayMode,2); |
|
248 CleanupClosePushL(w2); |
|
249 TEST(KErrNone == err); |
|
250 |
|
251 CleanupStack::Pop(2); |
|
252 |
|
253 // w1 State Final |
|
254 w1.Close(); |
|
255 |
|
256 // w2 State Final |
|
257 w2.Close(); |
|
258 |
|
259 RBackedUpWindow w3(rws); |
|
260 // w3 State 0 |
|
261 err = w3.Construct(wg,aDisplayMode,1); |
|
262 CleanupClosePushL(w3); |
|
263 TEST(KErrNone == err); |
|
264 |
|
265 CleanupStack::Pop(2); |
|
266 |
|
267 // w3 State Final |
|
268 w3.Close(); |
|
269 |
|
270 wg.Close(); |
|
271 |
|
272 RWindowGroup wg2(rws); |
|
273 CleanupClosePushL(wg2); |
|
274 err = wg2.Construct(0); |
|
275 TEST(KErrNone == err); |
|
276 |
|
277 RWindowGroup wg3(rws); |
|
278 err = wg3.Construct(1); |
|
279 CleanupClosePushL(wg3); |
|
280 TEST(KErrNone == err); |
|
281 |
|
282 // w4 State 0 |
|
283 RBackedUpWindow w4(rws); |
|
284 err = w4.Construct(wg2,aDisplayMode,2); |
|
285 CleanupClosePushL(w4); |
|
286 TEST(KErrNone == err); |
|
287 |
|
288 // w5 State 0 |
|
289 RBackedUpWindow w5(rws); |
|
290 err = w5.Construct(wg3,aDisplayMode,3); |
|
291 CleanupClosePushL(w5); |
|
292 TEST(KErrNone == err); |
|
293 |
|
294 CleanupStack::Pop(5); |
|
295 |
|
296 // w4 State Final |
|
297 w4.Close(); |
|
298 |
|
299 // w5 State Final |
|
300 // Check nothing bad happens when calling Close more than once on RBackedUpWindow |
|
301 w5.Close(); |
|
302 w5.Close(); |
|
303 |
|
304 wg2.Close(); |
|
305 wg3.Close(); |
|
306 rws.Close(); |
|
307 __UHEAP_MARKEND; |
|
308 } |
|
309 |
|
310 void CTWindowSizeCacheTest::TestRWindowNoCacheEntryL(TSizeCacheStatus aEnableWindowSizeCache) |
|
311 { |
|
312 __UHEAP_MARK; |
|
313 // w* State Initial |
|
314 RWsSession rws; |
|
315 TInt err = rws.Connect(); |
|
316 CleanupClosePushL(rws); |
|
317 TEST(err==KErrNone); |
|
318 |
|
319 if (aEnableWindowSizeCache) |
|
320 { |
|
321 rws.EnableWindowSizeCacheL(); |
|
322 } |
|
323 |
|
324 RWindowGroup wg(rws); |
|
325 wg.Construct(0); |
|
326 CleanupClosePushL(rws); |
|
327 |
|
328 // w1 State 0 |
|
329 RWindow w1(rws); |
|
330 w1.Construct(wg,1); |
|
331 CleanupClosePushL(w1); |
|
332 |
|
333 // w1 State Final |
|
334 CleanupStack::Pop(); |
|
335 w1.Close(); |
|
336 |
|
337 CleanupStack::Pop(); |
|
338 wg.Close(); |
|
339 |
|
340 CleanupStack::Pop(); |
|
341 rws.Close(); |
|
342 |
|
343 __UHEAP_MARKEND; |
|
344 } |
|
345 |
|
346 void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
347 { |
|
348 __UHEAP_MARK; |
|
349 // w* State Initial |
|
350 RWsSession rws; |
|
351 TInt err = rws.Connect(); |
|
352 CleanupClosePushL(rws); |
|
353 TEST(err==KErrNone); |
|
354 |
|
355 if (aEnableWindowSizeCache) |
|
356 { |
|
357 rws.EnableWindowSizeCacheL(); |
|
358 } |
|
359 |
|
360 RWindowGroup wg(rws); |
|
361 wg.Construct(0); |
|
362 CleanupClosePushL(rws); |
|
363 |
|
364 // w1 State 0 |
|
365 RWindow w1(rws); |
|
366 w1.Construct(wg,1); |
|
367 CleanupClosePushL(w1); |
|
368 |
|
369 // w1 State 0 |
|
370 TPoint point1 (10101,897); |
|
371 TSize size1 (10001,123); |
|
372 err = w1.SetExtentErr(point1, size1); |
|
373 TEST(KErrNone == err); |
|
374 |
|
375 // w1 State Final |
|
376 CleanupStack::Pop(); |
|
377 w1.Close(); |
|
378 |
|
379 CleanupStack::Pop(); |
|
380 wg.Close(); |
|
381 |
|
382 CleanupStack::Pop(); |
|
383 rws.Close(); |
|
384 |
|
385 __UHEAP_MARKEND; |
|
386 } |
|
387 |
|
388 void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
389 { |
|
390 __UHEAP_MARK; |
|
391 // w* State Initial |
|
392 RWsSession rws; |
|
393 TInt err = rws.Connect(); |
|
394 CleanupClosePushL(rws); |
|
395 TEST(err==KErrNone); |
|
396 |
|
397 if (aEnableWindowSizeCache) |
|
398 { |
|
399 rws.EnableWindowSizeCacheL(); |
|
400 } |
|
401 |
|
402 RWindowGroup wg(rws); |
|
403 wg.Construct(0); |
|
404 CleanupClosePushL(rws); |
|
405 |
|
406 // w1 State 0 |
|
407 RWindow w1(rws); |
|
408 w1.Construct(wg,1); |
|
409 CleanupClosePushL(w1); |
|
410 |
|
411 // w1 State 0 |
|
412 TSize size1 (10001,123); |
|
413 err = w1.SetSizeErr(size1); |
|
414 TEST(KErrNone == err); |
|
415 |
|
416 // w1 State Final |
|
417 CleanupStack::Pop(); |
|
418 w1.Close(); |
|
419 |
|
420 CleanupStack::Pop(); |
|
421 wg.Close(); |
|
422 |
|
423 CleanupStack::Pop(); |
|
424 rws.Close(); |
|
425 |
|
426 __UHEAP_MARKEND; |
|
427 } |
|
428 |
|
429 void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetExtentL(TSizeCacheStatus aEnableWindowSizeCache) |
|
430 { |
|
431 __UHEAP_MARK; |
|
432 // w* State Initial |
|
433 RWsSession rws; |
|
434 TInt err = rws.Connect(); |
|
435 CleanupClosePushL(rws); |
|
436 TEST(err==KErrNone); |
|
437 |
|
438 if (aEnableWindowSizeCache) |
|
439 { |
|
440 rws.EnableWindowSizeCacheL(); |
|
441 } |
|
442 |
|
443 RWindowGroup wg(rws); |
|
444 wg.Construct(0); |
|
445 CleanupClosePushL(rws); |
|
446 |
|
447 // w1 State 0 |
|
448 RWindow w1(rws); |
|
449 w1.Construct(wg,1); |
|
450 CleanupClosePushL(w1); |
|
451 |
|
452 // w1 State 0 |
|
453 TPoint point1 (10101,897); |
|
454 TSize size1 (10001,123); |
|
455 w1.SetExtent(point1, size1); |
|
456 rws.Flush(); |
|
457 |
|
458 // w1 State Final |
|
459 CleanupStack::Pop(); |
|
460 w1.Close(); |
|
461 |
|
462 CleanupStack::Pop(); |
|
463 wg.Close(); |
|
464 |
|
465 CleanupStack::Pop(); |
|
466 rws.Close(); |
|
467 |
|
468 __UHEAP_MARKEND; |
|
469 } |
|
470 |
|
471 void CTWindowSizeCacheTest::TestRWindowNoCacheEntrySetSizeL(TSizeCacheStatus aEnableWindowSizeCache) |
|
472 { |
|
473 __UHEAP_MARK; |
|
474 // w* State Initial |
|
475 RWsSession rws; |
|
476 TInt err = rws.Connect(); |
|
477 CleanupClosePushL(rws); |
|
478 TEST(err==KErrNone); |
|
479 |
|
480 if (aEnableWindowSizeCache) |
|
481 { |
|
482 rws.EnableWindowSizeCacheL(); |
|
483 } |
|
484 |
|
485 RWindowGroup wg(rws); |
|
486 wg.Construct(0); |
|
487 CleanupClosePushL(rws); |
|
488 |
|
489 // w1 State 0 |
|
490 RWindow w1(rws); |
|
491 w1.Construct(wg,1); |
|
492 CleanupClosePushL(w1); |
|
493 |
|
494 // w1 State 0 |
|
495 TSize size1 (10001,123); |
|
496 w1.SetSize(size1); |
|
497 rws.Flush(); |
|
498 |
|
499 // w1 State Final |
|
500 CleanupStack::Pop(); |
|
501 w1.Close(); |
|
502 |
|
503 CleanupStack::Pop(); |
|
504 wg.Close(); |
|
505 |
|
506 CleanupStack::Pop(); |
|
507 rws.Close(); |
|
508 |
|
509 __UHEAP_MARKEND; |
|
510 } |
|
511 |
|
512 void CTWindowSizeCacheTest::TestRWindowNoCacheEntryEnableWindowSizeCacheL() |
|
513 { |
|
514 __UHEAP_MARK; |
|
515 // w* State Initial |
|
516 RWsSession rws; |
|
517 TInt err = rws.Connect(); |
|
518 CleanupClosePushL(rws); |
|
519 TEST(err==KErrNone); |
|
520 |
|
521 rws.EnableWindowSizeCacheL(); |
|
522 |
|
523 RWindowGroup wg(rws); |
|
524 wg.Construct(0); |
|
525 CleanupClosePushL(rws); |
|
526 |
|
527 // w1 State 0 |
|
528 RWindow w1(rws); |
|
529 w1.Construct(wg,1); |
|
530 CleanupClosePushL(w1); |
|
531 |
|
532 // w1 State 0 |
|
533 // Only the first call to EnableWindowSizeCacheL() should have an effect |
|
534 // All subsequent calls to EnableWindowSizeCacheL() should have no effect |
|
535 rws.EnableWindowSizeCacheL(); |
|
536 |
|
537 // w1 State Final |
|
538 CleanupStack::Pop(); |
|
539 w1.Close(); |
|
540 |
|
541 CleanupStack::Pop(); |
|
542 wg.Close(); |
|
543 |
|
544 CleanupStack::Pop(); |
|
545 rws.Close(); |
|
546 |
|
547 __UHEAP_MARKEND; |
|
548 } |
|
549 |
|
550 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanL(TSizeCacheStatus aEnableWindowSizeCache) |
|
551 { |
|
552 __UHEAP_MARK; |
|
553 // w* State Initial |
|
554 RWsSession rws; |
|
555 TInt err = rws.Connect(); |
|
556 CleanupClosePushL(rws); |
|
557 TEST(err==KErrNone); |
|
558 |
|
559 if (aEnableWindowSizeCache) |
|
560 { |
|
561 rws.EnableWindowSizeCacheL(); |
|
562 } |
|
563 |
|
564 RWindowGroup wg(rws); |
|
565 wg.Construct(0); |
|
566 CleanupClosePushL(rws); |
|
567 |
|
568 // w1 State 0 |
|
569 RWindow w1(rws); |
|
570 w1.Construct(wg,1); |
|
571 CleanupClosePushL(w1); |
|
572 |
|
573 // w1 State 0 |
|
574 TSize size1 (10001,123); |
|
575 w1.SetSize(size1); |
|
576 rws.Flush(); |
|
577 |
|
578 // w1 State 1 |
|
579 TSize retSize1 = w1.Size(); |
|
580 TEST(retSize1 == size1); |
|
581 |
|
582 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
583 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
584 TEST(retSizeForEgl1 == size1); |
|
585 #endif |
|
586 |
|
587 // w1 State Final |
|
588 CleanupStack::Pop(); |
|
589 w1.Close(); |
|
590 |
|
591 CleanupStack::Pop(); |
|
592 wg.Close(); |
|
593 |
|
594 CleanupStack::Pop(); |
|
595 rws.Close(); |
|
596 |
|
597 __UHEAP_MARKEND; |
|
598 } |
|
599 |
|
600 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanSizeL(TSizeCacheStatus aEnableWindowSizeCache) |
|
601 { |
|
602 __UHEAP_MARK; |
|
603 // w* State Initial |
|
604 RWsSession rws; |
|
605 TInt err = rws.Connect(); |
|
606 CleanupClosePushL(rws); |
|
607 TEST(err==KErrNone); |
|
608 |
|
609 if (aEnableWindowSizeCache) |
|
610 { |
|
611 rws.EnableWindowSizeCacheL(); |
|
612 } |
|
613 |
|
614 RWindowGroup wg(rws); |
|
615 wg.Construct(0); |
|
616 CleanupClosePushL(rws); |
|
617 |
|
618 // w1 State 0 |
|
619 RWindow w1(rws); |
|
620 w1.Construct(wg,1); |
|
621 CleanupClosePushL(w1); |
|
622 |
|
623 // w1 State 0 |
|
624 TSize size1 (10001,123); |
|
625 w1.SetSize(size1); |
|
626 rws.Flush(); |
|
627 |
|
628 // w1 State 1 |
|
629 TSize retSize1 = w1.Size(); |
|
630 TEST(retSize1 == size1); |
|
631 |
|
632 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
633 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
634 TEST(retSizeForEgl1 == size1); |
|
635 #endif |
|
636 |
|
637 // w1 State 1 |
|
638 TSize retSize2 = w1.Size(); |
|
639 TEST(retSize2 == size1); |
|
640 |
|
641 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
642 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
643 TEST(retSizeForEgl2 == size1); |
|
644 #endif |
|
645 |
|
646 // w1 State Final |
|
647 CleanupStack::Pop(); |
|
648 w1.Close(); |
|
649 |
|
650 CleanupStack::Pop(); |
|
651 wg.Close(); |
|
652 |
|
653 CleanupStack::Pop(); |
|
654 rws.Close(); |
|
655 |
|
656 __UHEAP_MARKEND; |
|
657 } |
|
658 |
|
659 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheL() |
|
660 { |
|
661 __UHEAP_MARK; |
|
662 // w* State Initial |
|
663 RWsSession rws; |
|
664 TInt err = rws.Connect(); |
|
665 CleanupClosePushL(rws); |
|
666 TEST(err==KErrNone); |
|
667 |
|
668 rws.EnableWindowSizeCacheL(); |
|
669 |
|
670 RWindowGroup wg(rws); |
|
671 wg.Construct(0); |
|
672 CleanupClosePushL(rws); |
|
673 |
|
674 // w1 State 0 |
|
675 RWindow w1(rws); |
|
676 w1.Construct(wg,1); |
|
677 CleanupClosePushL(w1); |
|
678 |
|
679 // w1 State 0 |
|
680 TSize size1 (10001,123); |
|
681 w1.SetSize(size1); |
|
682 rws.Flush(); |
|
683 |
|
684 // w1 State 1 |
|
685 TSize retSize1 = w1.Size(); |
|
686 TEST(retSize1 == size1); |
|
687 |
|
688 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
689 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
690 TEST(retSizeForEgl1 == size1); |
|
691 #endif |
|
692 |
|
693 // w1 State 1 |
|
694 // Only the first call to EnableWindowSizeCacheL() should have an effect |
|
695 // All subsequent calls to EnableWindowSizeCacheL() should have no effect |
|
696 rws.EnableWindowSizeCacheL(); |
|
697 |
|
698 // w1 State Final |
|
699 CleanupStack::Pop(); |
|
700 w1.Close(); |
|
701 |
|
702 CleanupStack::Pop(); |
|
703 wg.Close(); |
|
704 |
|
705 CleanupStack::Pop(); |
|
706 rws.Close(); |
|
707 |
|
708 __UHEAP_MARKEND; |
|
709 } |
|
710 |
|
711 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheLSizeL() |
|
712 { |
|
713 __UHEAP_MARK; |
|
714 // w* State Initial |
|
715 RWsSession rws; |
|
716 TInt err = rws.Connect(); |
|
717 CleanupClosePushL(rws); |
|
718 TEST(err==KErrNone); |
|
719 |
|
720 rws.EnableWindowSizeCacheL(); |
|
721 |
|
722 RWindowGroup wg(rws); |
|
723 wg.Construct(0); |
|
724 CleanupClosePushL(rws); |
|
725 |
|
726 // w1 State 0 |
|
727 RWindow w1(rws); |
|
728 w1.Construct(wg,1); |
|
729 CleanupClosePushL(w1); |
|
730 |
|
731 // w1 State 0 |
|
732 TSize size1 (10001,123); |
|
733 w1.SetSize(size1); |
|
734 rws.Flush(); |
|
735 |
|
736 // w1 State 1 |
|
737 TSize retSize1 = w1.Size(); |
|
738 TEST(retSize1 == size1); |
|
739 |
|
740 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
741 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
742 TEST(retSizeForEgl1 == size1); |
|
743 #endif |
|
744 |
|
745 // w1 State 1 |
|
746 // Only the first call to EnableWindowSizeCacheL() should have an effect |
|
747 // All subsequent calls to EnableWindowSizeCacheL() should have no effect |
|
748 rws.EnableWindowSizeCacheL(); |
|
749 |
|
750 // w1 State 1 |
|
751 TSize retSize2 = w1.Size(); |
|
752 TEST(retSize2 == size1); |
|
753 |
|
754 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
755 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
756 TEST(retSizeForEgl2 == size1); |
|
757 #endif |
|
758 |
|
759 // w1 State Final |
|
760 CleanupStack::Pop(); |
|
761 w1.Close(); |
|
762 |
|
763 CleanupStack::Pop(); |
|
764 wg.Close(); |
|
765 |
|
766 CleanupStack::Pop(); |
|
767 rws.Close(); |
|
768 |
|
769 __UHEAP_MARKEND; |
|
770 } |
|
771 |
|
772 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeL(TSizeCacheStatus aEnableWindowSizeCache) |
|
773 { |
|
774 __UHEAP_MARK; |
|
775 // w* State Initial |
|
776 RWsSession rws; |
|
777 TInt err = rws.Connect(); |
|
778 CleanupClosePushL(rws); |
|
779 TEST(err==KErrNone); |
|
780 |
|
781 if (aEnableWindowSizeCache) |
|
782 { |
|
783 rws.EnableWindowSizeCacheL(); |
|
784 } |
|
785 |
|
786 RWindowGroup wg(rws); |
|
787 wg.Construct(0); |
|
788 CleanupClosePushL(rws); |
|
789 |
|
790 // w1 State 0 |
|
791 RWindow w1(rws); |
|
792 w1.Construct(wg,1); |
|
793 CleanupClosePushL(w1); |
|
794 |
|
795 // w1 State 0 |
|
796 TSize size1 (10001,123); |
|
797 w1.SetSize(size1); |
|
798 rws.Flush(); |
|
799 |
|
800 // w1 State 1 |
|
801 TSize retSize1 = w1.Size(); |
|
802 TEST(retSize1 == size1); |
|
803 |
|
804 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
805 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
806 TEST(retSizeForEgl1 == size1); |
|
807 #endif |
|
808 |
|
809 // w1 State 2 |
|
810 TSize size2 (20002,223); |
|
811 w1.SetSize(size2); |
|
812 rws.Flush(); |
|
813 |
|
814 // w1 State Final |
|
815 CleanupStack::Pop(); |
|
816 w1.Close(); |
|
817 |
|
818 CleanupStack::Pop(); |
|
819 wg.Close(); |
|
820 |
|
821 CleanupStack::Pop(); |
|
822 rws.Close(); |
|
823 |
|
824 __UHEAP_MARKEND; |
|
825 } |
|
826 |
|
827 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetExtentL(TSizeCacheStatus aEnableWindowSizeCache) |
|
828 { |
|
829 __UHEAP_MARK; |
|
830 // w* State Initial |
|
831 RWsSession rws; |
|
832 TInt err = rws.Connect(); |
|
833 CleanupClosePushL(rws); |
|
834 TEST(err==KErrNone); |
|
835 |
|
836 if (aEnableWindowSizeCache) |
|
837 { |
|
838 rws.EnableWindowSizeCacheL(); |
|
839 } |
|
840 |
|
841 RWindowGroup wg(rws); |
|
842 wg.Construct(0); |
|
843 CleanupClosePushL(rws); |
|
844 |
|
845 // w1 State 0 |
|
846 RWindow w1(rws); |
|
847 w1.Construct(wg,1); |
|
848 CleanupClosePushL(w1); |
|
849 |
|
850 // w1 State 0 |
|
851 TSize size1 (10001,123); |
|
852 w1.SetSize(size1); |
|
853 rws.Flush(); |
|
854 |
|
855 // w1 State 1 |
|
856 TSize retSize1 = w1.Size(); |
|
857 TEST(retSize1 == size1); |
|
858 |
|
859 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
860 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
861 TEST(retSizeForEgl1 == size1); |
|
862 #endif |
|
863 |
|
864 // w1 State 2 |
|
865 TPoint point2 (20202,223); |
|
866 TSize size2 (20002,223); |
|
867 w1.SetExtent(point2, size2); |
|
868 rws.Flush(); |
|
869 |
|
870 // w1 State Final |
|
871 CleanupStack::Pop(); |
|
872 w1.Close(); |
|
873 |
|
874 CleanupStack::Pop(); |
|
875 wg.Close(); |
|
876 |
|
877 CleanupStack::Pop(); |
|
878 rws.Close(); |
|
879 |
|
880 __UHEAP_MARKEND; |
|
881 } |
|
882 |
|
883 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
884 { |
|
885 __UHEAP_MARK; |
|
886 // w* State Initial |
|
887 RWsSession rws; |
|
888 TInt err = rws.Connect(); |
|
889 CleanupClosePushL(rws); |
|
890 TEST(err==KErrNone); |
|
891 |
|
892 if (aEnableWindowSizeCache) |
|
893 { |
|
894 rws.EnableWindowSizeCacheL(); |
|
895 } |
|
896 |
|
897 RWindowGroup wg(rws); |
|
898 wg.Construct(0); |
|
899 CleanupClosePushL(rws); |
|
900 |
|
901 // w1 State 0 |
|
902 RWindow w1(rws); |
|
903 w1.Construct(wg,1); |
|
904 CleanupClosePushL(w1); |
|
905 |
|
906 // w1 State 0 |
|
907 TSize size1 (10001,123); |
|
908 w1.SetSize(size1); |
|
909 rws.Flush(); |
|
910 |
|
911 // w1 State 1 |
|
912 TSize retSize1 = w1.Size(); |
|
913 TEST(retSize1 == size1); |
|
914 |
|
915 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
916 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
917 TEST(retSizeForEgl1 == size1); |
|
918 #endif |
|
919 |
|
920 // w1 State 2 |
|
921 TSize size2 (20002,223); |
|
922 err = w1.SetSizeErr(size2); |
|
923 TEST(KErrNone == err); |
|
924 |
|
925 // w1 State Final |
|
926 CleanupStack::Pop(); |
|
927 w1.Close(); |
|
928 |
|
929 CleanupStack::Pop(); |
|
930 wg.Close(); |
|
931 |
|
932 CleanupStack::Pop(); |
|
933 rws.Close(); |
|
934 |
|
935 __UHEAP_MARKEND; |
|
936 } |
|
937 |
|
938 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
939 { |
|
940 __UHEAP_MARK; |
|
941 // w* State Initial |
|
942 RWsSession rws; |
|
943 TInt err = rws.Connect(); |
|
944 CleanupClosePushL(rws); |
|
945 TEST(err==KErrNone); |
|
946 |
|
947 if (aEnableWindowSizeCache) |
|
948 { |
|
949 rws.EnableWindowSizeCacheL(); |
|
950 } |
|
951 |
|
952 RWindowGroup wg(rws); |
|
953 wg.Construct(0); |
|
954 CleanupClosePushL(rws); |
|
955 |
|
956 // w1 State 0 |
|
957 RWindow w1(rws); |
|
958 w1.Construct(wg,1); |
|
959 CleanupClosePushL(w1); |
|
960 |
|
961 // w1 State 0 |
|
962 TSize size1 (10001,123); |
|
963 w1.SetSize(size1); |
|
964 rws.Flush(); |
|
965 |
|
966 // w1 State 1 |
|
967 TSize retSize1 = w1.Size(); |
|
968 TEST(retSize1 == size1); |
|
969 |
|
970 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
971 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
972 TEST(retSizeForEgl1 == size1); |
|
973 #endif |
|
974 |
|
975 // w1 State 2 |
|
976 TPoint point2 (20202,223); |
|
977 TSize size2 (20002,223); |
|
978 err = w1.SetExtentErr(point2, size2); |
|
979 TEST(KErrNone == err); |
|
980 |
|
981 // w1 State Final |
|
982 CleanupStack::Pop(); |
|
983 w1.Close(); |
|
984 |
|
985 CleanupStack::Pop(); |
|
986 wg.Close(); |
|
987 |
|
988 CleanupStack::Pop(); |
|
989 rws.Close(); |
|
990 |
|
991 __UHEAP_MARKEND; |
|
992 } |
|
993 |
|
994 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache) |
|
995 { |
|
996 __UHEAP_MARK; |
|
997 // w* State Initial |
|
998 RWsSession rws; |
|
999 TInt err = rws.Connect(); |
|
1000 CleanupClosePushL(rws); |
|
1001 TEST(err==KErrNone); |
|
1002 |
|
1003 if (aEnableWindowSizeCache) |
|
1004 { |
|
1005 rws.EnableWindowSizeCacheL(); |
|
1006 } |
|
1007 |
|
1008 RWindowGroup wg(rws); |
|
1009 wg.Construct(0); |
|
1010 CleanupClosePushL(rws); |
|
1011 |
|
1012 // w1 State 0 |
|
1013 RWindow w1(rws); |
|
1014 w1.Construct(wg,1); |
|
1015 CleanupClosePushL(w1); |
|
1016 |
|
1017 // w1 State 0 |
|
1018 TSize size1 (10001,123); |
|
1019 w1.SetSize(size1); |
|
1020 rws.Flush(); |
|
1021 |
|
1022 // w1 State 1 |
|
1023 TSize retSize1 = w1.Size(); |
|
1024 TEST(retSize1 == size1); |
|
1025 |
|
1026 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1027 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1028 TEST(retSizeForEgl1 == size1); |
|
1029 #endif |
|
1030 |
|
1031 // w1 State 2 |
|
1032 TSize size2 (20002,223); |
|
1033 w1.SetSize(size2); |
|
1034 |
|
1035 TSize size3 (30003,323); |
|
1036 // w1 State 2 |
|
1037 w1.SetSize(size3); |
|
1038 rws.Flush(); |
|
1039 |
|
1040 // w1 State Final |
|
1041 CleanupStack::Pop(); |
|
1042 w1.Close(); |
|
1043 |
|
1044 CleanupStack::Pop(); |
|
1045 wg.Close(); |
|
1046 |
|
1047 CleanupStack::Pop(); |
|
1048 rws.Close(); |
|
1049 |
|
1050 __UHEAP_MARKEND; |
|
1051 } |
|
1052 |
|
1053 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1054 { |
|
1055 __UHEAP_MARK; |
|
1056 // w* State Initial |
|
1057 RWsSession rws; |
|
1058 TInt err = rws.Connect(); |
|
1059 CleanupClosePushL(rws); |
|
1060 TEST(err==KErrNone); |
|
1061 |
|
1062 if (aEnableWindowSizeCache) |
|
1063 { |
|
1064 rws.EnableWindowSizeCacheL(); |
|
1065 } |
|
1066 |
|
1067 RWindowGroup wg(rws); |
|
1068 wg.Construct(0); |
|
1069 CleanupClosePushL(rws); |
|
1070 |
|
1071 // w1 State 0 |
|
1072 RWindow w1(rws); |
|
1073 w1.Construct(wg,1); |
|
1074 CleanupClosePushL(w1); |
|
1075 |
|
1076 // w1 State 0 |
|
1077 TSize size1 (10001,123); |
|
1078 w1.SetSize(size1); |
|
1079 rws.Flush(); |
|
1080 |
|
1081 // w1 State 1 |
|
1082 TSize retSize1 = w1.Size(); |
|
1083 TEST(retSize1 == size1); |
|
1084 |
|
1085 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1086 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1087 TEST(retSizeForEgl1 == size1); |
|
1088 #endif |
|
1089 |
|
1090 // w1 State 2 |
|
1091 TSize size2 (20002,223); |
|
1092 w1.SetSize(size2); |
|
1093 |
|
1094 // w1 State 2 |
|
1095 TPoint point3 (30303,232); |
|
1096 TSize size3 (30003,323); |
|
1097 w1.SetExtent(point3, size3); |
|
1098 rws.Flush(); |
|
1099 |
|
1100 // w1 State Final |
|
1101 CleanupStack::Pop(); |
|
1102 w1.Close(); |
|
1103 |
|
1104 CleanupStack::Pop(); |
|
1105 wg.Close(); |
|
1106 |
|
1107 CleanupStack::Pop(); |
|
1108 rws.Close(); |
|
1109 |
|
1110 __UHEAP_MARKEND; |
|
1111 } |
|
1112 |
|
1113 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1114 { |
|
1115 __UHEAP_MARK; |
|
1116 // w* State Initial |
|
1117 RWsSession rws; |
|
1118 TInt err = rws.Connect(); |
|
1119 CleanupClosePushL(rws); |
|
1120 TEST(err==KErrNone); |
|
1121 |
|
1122 if (aEnableWindowSizeCache) |
|
1123 { |
|
1124 rws.EnableWindowSizeCacheL(); |
|
1125 } |
|
1126 |
|
1127 RWindowGroup wg(rws); |
|
1128 wg.Construct(0); |
|
1129 CleanupClosePushL(rws); |
|
1130 |
|
1131 // w1 State 0 |
|
1132 RWindow w1(rws); |
|
1133 w1.Construct(wg,1); |
|
1134 CleanupClosePushL(w1); |
|
1135 |
|
1136 // w1 State 0 |
|
1137 TSize size1 (10001,123); |
|
1138 w1.SetSize(size1); |
|
1139 rws.Flush(); |
|
1140 |
|
1141 // w1 State 1 |
|
1142 TSize retSize1 = w1.Size(); |
|
1143 TEST(retSize1 == size1); |
|
1144 |
|
1145 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1146 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1147 TEST(retSizeForEgl1 == size1); |
|
1148 #endif |
|
1149 |
|
1150 // w1 State 2 |
|
1151 TSize size2 (20002,223); |
|
1152 w1.SetSize(size2); |
|
1153 |
|
1154 // w1 State 2 |
|
1155 TSize size3 (30003,323); |
|
1156 err = w1.SetSizeErr(size3); |
|
1157 TEST(KErrNone == err); |
|
1158 |
|
1159 // w1 State Final |
|
1160 CleanupStack::Pop(); |
|
1161 w1.Close(); |
|
1162 |
|
1163 CleanupStack::Pop(); |
|
1164 wg.Close(); |
|
1165 |
|
1166 CleanupStack::Pop(); |
|
1167 rws.Close(); |
|
1168 |
|
1169 __UHEAP_MARKEND; |
|
1170 } |
|
1171 |
|
1172 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1173 { |
|
1174 __UHEAP_MARK; |
|
1175 // w* State Initial |
|
1176 RWsSession rws; |
|
1177 TInt err = rws.Connect(); |
|
1178 CleanupClosePushL(rws); |
|
1179 TEST(err==KErrNone); |
|
1180 |
|
1181 if (aEnableWindowSizeCache) |
|
1182 { |
|
1183 rws.EnableWindowSizeCacheL(); |
|
1184 } |
|
1185 |
|
1186 RWindowGroup wg(rws); |
|
1187 wg.Construct(0); |
|
1188 CleanupClosePushL(rws); |
|
1189 |
|
1190 // w1 State 0 |
|
1191 RWindow w1(rws); |
|
1192 w1.Construct(wg,1); |
|
1193 CleanupClosePushL(w1); |
|
1194 |
|
1195 // w1 State 0 |
|
1196 TSize size1 (10001,123); |
|
1197 w1.SetSize(size1); |
|
1198 rws.Flush(); |
|
1199 |
|
1200 // w1 State 1 |
|
1201 TSize retSize1 = w1.Size(); |
|
1202 TEST(retSize1 == size1); |
|
1203 |
|
1204 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1205 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1206 TEST(retSizeForEgl1 == size1); |
|
1207 #endif |
|
1208 |
|
1209 // w1 State 2 |
|
1210 TSize size2 (20002,223); |
|
1211 w1.SetSize(size2); |
|
1212 |
|
1213 // w1 State 2 |
|
1214 TPoint point3 (30303,232); |
|
1215 TSize size3 (30003,323); |
|
1216 err = w1.SetExtentErr(point3, size3); |
|
1217 TEST(KErrNone == err); |
|
1218 |
|
1219 // w1 State Final |
|
1220 CleanupStack::Pop(); |
|
1221 w1.Close(); |
|
1222 |
|
1223 CleanupStack::Pop(); |
|
1224 wg.Close(); |
|
1225 |
|
1226 CleanupStack::Pop(); |
|
1227 rws.Close(); |
|
1228 |
|
1229 __UHEAP_MARKEND; |
|
1230 } |
|
1231 |
|
1232 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtySetSizeEnableWindowSizeCacheL() |
|
1233 { |
|
1234 __UHEAP_MARK; |
|
1235 // w* State Initial |
|
1236 RWsSession rws; |
|
1237 TInt err = rws.Connect(); |
|
1238 CleanupClosePushL(rws); |
|
1239 TEST(err==KErrNone); |
|
1240 |
|
1241 rws.EnableWindowSizeCacheL(); |
|
1242 |
|
1243 RWindowGroup wg(rws); |
|
1244 wg.Construct(0); |
|
1245 CleanupClosePushL(rws); |
|
1246 |
|
1247 // w1 State 0 |
|
1248 RWindow w1(rws); |
|
1249 w1.Construct(wg,1); |
|
1250 CleanupClosePushL(w1); |
|
1251 |
|
1252 // w1 State 0 |
|
1253 TSize size1 (10001,123); |
|
1254 w1.SetSize(size1); |
|
1255 rws.Flush(); |
|
1256 |
|
1257 // w1 State 1 |
|
1258 TSize retSize1 = w1.Size(); |
|
1259 TEST(retSize1 == size1); |
|
1260 |
|
1261 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1262 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1263 TEST(retSizeForEgl1 == size1); |
|
1264 #endif |
|
1265 |
|
1266 // w1 State 2 |
|
1267 TSize size2 (20002,223); |
|
1268 w1.SetSize(size2); |
|
1269 |
|
1270 // Only the first call to EnableWindowSizeCacheL() should have an effect |
|
1271 // All subsequent calls to EnableWindowSizeCacheL() should have no effect |
|
1272 rws.EnableWindowSizeCacheL(); |
|
1273 |
|
1274 // w1 State Final |
|
1275 CleanupStack::Pop(); |
|
1276 w1.Close(); |
|
1277 |
|
1278 CleanupStack::Pop(); |
|
1279 wg.Close(); |
|
1280 |
|
1281 CleanupStack::Pop(); |
|
1282 rws.Close(); |
|
1283 |
|
1284 __UHEAP_MARKEND; |
|
1285 } |
|
1286 |
|
1287 //------------------------------------------------------------------------------------------- |
|
1288 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1289 { |
|
1290 __UHEAP_MARK; |
|
1291 // w* State Initial |
|
1292 RWsSession rws; |
|
1293 TInt err = rws.Connect(); |
|
1294 CleanupClosePushL(rws); |
|
1295 TEST(err==KErrNone); |
|
1296 |
|
1297 if (aEnableWindowSizeCache) |
|
1298 { |
|
1299 rws.EnableWindowSizeCacheL(); |
|
1300 } |
|
1301 |
|
1302 RWindowGroup wg(rws); |
|
1303 wg.Construct(0); |
|
1304 CleanupClosePushL(rws); |
|
1305 |
|
1306 // w1 State 0 |
|
1307 RWindow w1(rws); |
|
1308 w1.Construct(wg,1); |
|
1309 CleanupClosePushL(w1); |
|
1310 |
|
1311 // w1 State 0 |
|
1312 TSize size1 (10001,123); |
|
1313 w1.SetSize(size1); |
|
1314 rws.Flush(); |
|
1315 |
|
1316 // w1 State 1 |
|
1317 TSize retSize1 = w1.Size(); |
|
1318 TEST(retSize1 == size1); |
|
1319 |
|
1320 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1321 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1322 TEST(retSizeForEgl1 == size1); |
|
1323 #endif |
|
1324 |
|
1325 // w1 State 2 |
|
1326 TSize size2 (20002,223); |
|
1327 w1.SetSize(size2); |
|
1328 rws.Flush(); |
|
1329 |
|
1330 // w1 State 1 |
|
1331 TSize retSize2 = w1.Size(); |
|
1332 TEST(retSize2 == size2); |
|
1333 |
|
1334 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1335 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1336 TEST(retSizeForEgl2 == size2); |
|
1337 #endif |
|
1338 |
|
1339 // w1 State Final |
|
1340 CleanupStack::Pop(); |
|
1341 w1.Close(); |
|
1342 |
|
1343 CleanupStack::Pop(); |
|
1344 wg.Close(); |
|
1345 |
|
1346 CleanupStack::Pop(); |
|
1347 rws.Close(); |
|
1348 |
|
1349 __UHEAP_MARKEND; |
|
1350 } |
|
1351 |
|
1352 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1353 { |
|
1354 __UHEAP_MARK; |
|
1355 // w* State Initial |
|
1356 RWsSession rws; |
|
1357 TInt err = rws.Connect(); |
|
1358 CleanupClosePushL(rws); |
|
1359 TEST(err==KErrNone); |
|
1360 |
|
1361 if (aEnableWindowSizeCache) |
|
1362 { |
|
1363 rws.EnableWindowSizeCacheL(); |
|
1364 } |
|
1365 |
|
1366 RWindowGroup wg(rws); |
|
1367 wg.Construct(0); |
|
1368 CleanupClosePushL(rws); |
|
1369 |
|
1370 // w1 State 0 |
|
1371 RWindow w1(rws); |
|
1372 w1.Construct(wg,1); |
|
1373 CleanupClosePushL(w1); |
|
1374 |
|
1375 // w1 State 0 |
|
1376 TSize size1 (10001,123); |
|
1377 w1.SetSize(size1); |
|
1378 rws.Flush(); |
|
1379 |
|
1380 // w1 State 1 |
|
1381 TSize retSize1 = w1.Size(); |
|
1382 TEST(retSize1 == size1); |
|
1383 |
|
1384 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1385 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1386 TEST(retSizeForEgl1 == size1); |
|
1387 #endif |
|
1388 |
|
1389 // w1 State 2 |
|
1390 TPoint point2 (20202,223); |
|
1391 TSize size2 (20002,223); |
|
1392 w1.SetExtent(point2, size2); |
|
1393 rws.Flush(); |
|
1394 |
|
1395 // w1 State 1 |
|
1396 TSize retSize2 = w1.Size(); |
|
1397 TEST(retSize2 == size2); |
|
1398 |
|
1399 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1400 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1401 TEST(retSizeForEgl2 == size2); |
|
1402 #endif |
|
1403 |
|
1404 // w1 State Final |
|
1405 CleanupStack::Pop(); |
|
1406 w1.Close(); |
|
1407 |
|
1408 CleanupStack::Pop(); |
|
1409 wg.Close(); |
|
1410 |
|
1411 CleanupStack::Pop(); |
|
1412 rws.Close(); |
|
1413 |
|
1414 __UHEAP_MARKEND; |
|
1415 } |
|
1416 |
|
1417 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1418 { |
|
1419 __UHEAP_MARK; |
|
1420 // w* State Initial |
|
1421 RWsSession rws; |
|
1422 TInt err = rws.Connect(); |
|
1423 CleanupClosePushL(rws); |
|
1424 TEST(err==KErrNone); |
|
1425 |
|
1426 if (aEnableWindowSizeCache) |
|
1427 { |
|
1428 rws.EnableWindowSizeCacheL(); |
|
1429 } |
|
1430 |
|
1431 RWindowGroup wg(rws); |
|
1432 wg.Construct(0); |
|
1433 CleanupClosePushL(rws); |
|
1434 |
|
1435 // w1 State 0 |
|
1436 RWindow w1(rws); |
|
1437 w1.Construct(wg,1); |
|
1438 CleanupClosePushL(w1); |
|
1439 |
|
1440 // w1 State 0 |
|
1441 TSize size1 (10001,123); |
|
1442 w1.SetSize(size1); |
|
1443 rws.Flush(); |
|
1444 |
|
1445 // w1 State 1 |
|
1446 TSize retSize1 = w1.Size(); |
|
1447 TEST(retSize1 == size1); |
|
1448 |
|
1449 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1450 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1451 TEST(retSizeForEgl1 == size1); |
|
1452 #endif |
|
1453 |
|
1454 // w1 State 2 |
|
1455 TSize size2 (20002,223); |
|
1456 err = w1.SetSizeErr(size2); |
|
1457 TEST(KErrNone == err); |
|
1458 |
|
1459 // w1 State 1 |
|
1460 TSize retSize2 = w1.Size(); |
|
1461 TEST(retSize2 == size2); |
|
1462 |
|
1463 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1464 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1465 TEST(retSizeForEgl2 == size2); |
|
1466 #endif |
|
1467 |
|
1468 // w1 State Final |
|
1469 CleanupStack::Pop(); |
|
1470 w1.Close(); |
|
1471 |
|
1472 CleanupStack::Pop(); |
|
1473 wg.Close(); |
|
1474 |
|
1475 CleanupStack::Pop(); |
|
1476 rws.Close(); |
|
1477 |
|
1478 __UHEAP_MARKEND; |
|
1479 } |
|
1480 |
|
1481 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1482 { |
|
1483 __UHEAP_MARK; |
|
1484 // w* State Initial |
|
1485 RWsSession rws; |
|
1486 TInt err = rws.Connect(); |
|
1487 CleanupClosePushL(rws); |
|
1488 TEST(err==KErrNone); |
|
1489 |
|
1490 if (aEnableWindowSizeCache) |
|
1491 { |
|
1492 rws.EnableWindowSizeCacheL(); |
|
1493 } |
|
1494 |
|
1495 RWindowGroup wg(rws); |
|
1496 wg.Construct(0); |
|
1497 CleanupClosePushL(rws); |
|
1498 |
|
1499 // w1 State 0 |
|
1500 RWindow w1(rws); |
|
1501 w1.Construct(wg,1); |
|
1502 CleanupClosePushL(w1); |
|
1503 |
|
1504 // w1 State 0 |
|
1505 TSize size1 (10001,123); |
|
1506 w1.SetSize(size1); |
|
1507 rws.Flush(); |
|
1508 |
|
1509 // w1 State 1 |
|
1510 TSize retSize1 = w1.Size(); |
|
1511 TEST(retSize1 == size1); |
|
1512 |
|
1513 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1514 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1515 TEST(retSizeForEgl1 == size1); |
|
1516 #endif |
|
1517 |
|
1518 // w1 State 2 |
|
1519 TPoint point2 (20202,223); |
|
1520 TSize size2 (20002,223); |
|
1521 err = w1.SetExtentErr(point2, size2); |
|
1522 TEST(KErrNone == err); |
|
1523 |
|
1524 // w1 State 1 |
|
1525 TSize retSize2 = w1.Size(); |
|
1526 TEST(retSize2 == size2); |
|
1527 |
|
1528 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1529 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1530 TEST(retSizeForEgl2 == size2); |
|
1531 #endif |
|
1532 |
|
1533 // w1 State Final |
|
1534 CleanupStack::Pop(); |
|
1535 w1.Close(); |
|
1536 |
|
1537 CleanupStack::Pop(); |
|
1538 wg.Close(); |
|
1539 |
|
1540 CleanupStack::Pop(); |
|
1541 rws.Close(); |
|
1542 |
|
1543 __UHEAP_MARKEND; |
|
1544 } |
|
1545 |
|
1546 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1547 { |
|
1548 __UHEAP_MARK; |
|
1549 // w* State Initial |
|
1550 RWsSession rws; |
|
1551 TInt err = rws.Connect(); |
|
1552 CleanupClosePushL(rws); |
|
1553 TEST(err==KErrNone); |
|
1554 |
|
1555 if (aEnableWindowSizeCache) |
|
1556 { |
|
1557 rws.EnableWindowSizeCacheL(); |
|
1558 } |
|
1559 |
|
1560 RWindowGroup wg(rws); |
|
1561 wg.Construct(0); |
|
1562 CleanupClosePushL(rws); |
|
1563 |
|
1564 // w1 State 0 |
|
1565 RWindow w1(rws); |
|
1566 w1.Construct(wg,1); |
|
1567 CleanupClosePushL(w1); |
|
1568 |
|
1569 // w1 State 0 |
|
1570 TSize size1 (10001,123); |
|
1571 w1.SetSize(size1); |
|
1572 rws.Flush(); |
|
1573 |
|
1574 // w1 State 1 |
|
1575 TSize retSize1 = w1.Size(); |
|
1576 TEST(retSize1 == size1); |
|
1577 |
|
1578 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1579 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1580 TEST(retSizeForEgl1 == size1); |
|
1581 #endif |
|
1582 |
|
1583 // w1 State 2 |
|
1584 TSize size2 (20002,223); |
|
1585 w1.SetSize(size2); |
|
1586 |
|
1587 TSize size3 (30003,323); |
|
1588 // w1 State 2 |
|
1589 w1.SetSize(size3); |
|
1590 rws.Flush(); |
|
1591 |
|
1592 // w1 State 1 |
|
1593 TSize retSize2 = w1.Size(); |
|
1594 TEST(retSize2 == size3); |
|
1595 |
|
1596 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1597 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1598 TEST(retSizeForEgl2 == size3); |
|
1599 #endif |
|
1600 |
|
1601 // w1 State Final |
|
1602 CleanupStack::Pop(); |
|
1603 w1.Close(); |
|
1604 |
|
1605 CleanupStack::Pop(); |
|
1606 wg.Close(); |
|
1607 |
|
1608 CleanupStack::Pop(); |
|
1609 rws.Close(); |
|
1610 |
|
1611 __UHEAP_MARKEND; |
|
1612 } |
|
1613 |
|
1614 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1615 { |
|
1616 __UHEAP_MARK; |
|
1617 // w* State Initial |
|
1618 RWsSession rws; |
|
1619 TInt err = rws.Connect(); |
|
1620 CleanupClosePushL(rws); |
|
1621 TEST(err==KErrNone); |
|
1622 |
|
1623 if (aEnableWindowSizeCache) |
|
1624 { |
|
1625 rws.EnableWindowSizeCacheL(); |
|
1626 } |
|
1627 |
|
1628 RWindowGroup wg(rws); |
|
1629 wg.Construct(0); |
|
1630 CleanupClosePushL(rws); |
|
1631 |
|
1632 // w1 State 0 |
|
1633 RWindow w1(rws); |
|
1634 w1.Construct(wg,1); |
|
1635 CleanupClosePushL(w1); |
|
1636 |
|
1637 // w1 State 0 |
|
1638 TSize size1 (10001,123); |
|
1639 w1.SetSize(size1); |
|
1640 rws.Flush(); |
|
1641 |
|
1642 // w1 State 1 |
|
1643 TSize retSize1 = w1.Size(); |
|
1644 TEST(retSize1 == size1); |
|
1645 |
|
1646 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1647 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1648 TEST(retSizeForEgl1 == size1); |
|
1649 #endif |
|
1650 |
|
1651 // w1 State 2 |
|
1652 TSize size2 (20002,223); |
|
1653 w1.SetSize(size2); |
|
1654 |
|
1655 // w1 State 2 |
|
1656 TPoint point3 (30303,232); |
|
1657 TSize size3 (30003,323); |
|
1658 w1.SetExtent(point3, size3); |
|
1659 rws.Flush(); |
|
1660 |
|
1661 // w1 State 1 |
|
1662 TSize retSize2 = w1.Size(); |
|
1663 TEST(retSize2 == size3); |
|
1664 |
|
1665 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1666 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1667 TEST(retSizeForEgl2 == size3); |
|
1668 #endif |
|
1669 |
|
1670 // w1 State Final |
|
1671 CleanupStack::Pop(); |
|
1672 w1.Close(); |
|
1673 |
|
1674 CleanupStack::Pop(); |
|
1675 wg.Close(); |
|
1676 |
|
1677 CleanupStack::Pop(); |
|
1678 rws.Close(); |
|
1679 |
|
1680 __UHEAP_MARKEND; |
|
1681 } |
|
1682 |
|
1683 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1684 { |
|
1685 __UHEAP_MARK; |
|
1686 // w* State Initial |
|
1687 RWsSession rws; |
|
1688 TInt err = rws.Connect(); |
|
1689 CleanupClosePushL(rws); |
|
1690 TEST(err==KErrNone); |
|
1691 |
|
1692 if (aEnableWindowSizeCache) |
|
1693 { |
|
1694 rws.EnableWindowSizeCacheL(); |
|
1695 } |
|
1696 |
|
1697 RWindowGroup wg(rws); |
|
1698 wg.Construct(0); |
|
1699 CleanupClosePushL(rws); |
|
1700 |
|
1701 // w1 State 0 |
|
1702 RWindow w1(rws); |
|
1703 w1.Construct(wg,1); |
|
1704 CleanupClosePushL(w1); |
|
1705 |
|
1706 // w1 State 0 |
|
1707 TSize size1 (10001,123); |
|
1708 w1.SetSize(size1); |
|
1709 rws.Flush(); |
|
1710 |
|
1711 // w1 State 1 |
|
1712 TSize retSize1 = w1.Size(); |
|
1713 TEST(retSize1 == size1); |
|
1714 |
|
1715 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1716 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1717 TEST(retSizeForEgl1 == size1); |
|
1718 #endif |
|
1719 |
|
1720 // w1 State 2 |
|
1721 TSize size2 (20002,223); |
|
1722 w1.SetSize(size2); |
|
1723 |
|
1724 // w1 State 2 |
|
1725 TSize size3 (30003,323); |
|
1726 err = w1.SetSizeErr(size3); |
|
1727 TEST(KErrNone == err); |
|
1728 |
|
1729 // w1 State 1 |
|
1730 TSize retSize2 = w1.Size(); |
|
1731 TEST(retSize2 == size3); |
|
1732 |
|
1733 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1734 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1735 TEST(retSizeForEgl2 == size3); |
|
1736 #endif |
|
1737 |
|
1738 // w1 State Final |
|
1739 CleanupStack::Pop(); |
|
1740 w1.Close(); |
|
1741 |
|
1742 CleanupStack::Pop(); |
|
1743 wg.Close(); |
|
1744 |
|
1745 CleanupStack::Pop(); |
|
1746 rws.Close(); |
|
1747 |
|
1748 __UHEAP_MARKEND; |
|
1749 } |
|
1750 |
|
1751 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1752 { |
|
1753 __UHEAP_MARK; |
|
1754 // w* State Initial |
|
1755 RWsSession rws; |
|
1756 TInt err = rws.Connect(); |
|
1757 CleanupClosePushL(rws); |
|
1758 TEST(err==KErrNone); |
|
1759 |
|
1760 if (aEnableWindowSizeCache) |
|
1761 { |
|
1762 rws.EnableWindowSizeCacheL(); |
|
1763 } |
|
1764 |
|
1765 RWindowGroup wg(rws); |
|
1766 wg.Construct(0); |
|
1767 CleanupClosePushL(rws); |
|
1768 |
|
1769 // w1 State 0 |
|
1770 RWindow w1(rws); |
|
1771 w1.Construct(wg,1); |
|
1772 CleanupClosePushL(w1); |
|
1773 |
|
1774 // w1 State 0 |
|
1775 TSize size1 (10001,123); |
|
1776 w1.SetSize(size1); |
|
1777 rws.Flush(); |
|
1778 |
|
1779 // w1 State 1 |
|
1780 TSize retSize1 = w1.Size(); |
|
1781 TEST(retSize1 == size1); |
|
1782 |
|
1783 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1784 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1785 TEST(retSizeForEgl1 == size1); |
|
1786 #endif |
|
1787 |
|
1788 // w1 State 2 |
|
1789 TSize size2 (20002,223); |
|
1790 w1.SetSize(size2); |
|
1791 |
|
1792 // w1 State 2 |
|
1793 TPoint point3 (30303,232); |
|
1794 TSize size3 (30003,323); |
|
1795 err = w1.SetExtentErr(point3, size3); |
|
1796 TEST(KErrNone == err); |
|
1797 |
|
1798 // w1 State 1 |
|
1799 TSize retSize2 = w1.Size(); |
|
1800 TEST(retSize2 == size3); |
|
1801 |
|
1802 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1803 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1804 TEST(retSizeForEgl2 == size3); |
|
1805 #endif |
|
1806 |
|
1807 // w1 State Final |
|
1808 CleanupStack::Pop(); |
|
1809 w1.Close(); |
|
1810 |
|
1811 CleanupStack::Pop(); |
|
1812 wg.Close(); |
|
1813 |
|
1814 CleanupStack::Pop(); |
|
1815 rws.Close(); |
|
1816 |
|
1817 __UHEAP_MARKEND; |
|
1818 } |
|
1819 |
|
1820 void CTWindowSizeCacheTest::TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeEnableWindowSizeCacheL() |
|
1821 { |
|
1822 __UHEAP_MARK; |
|
1823 // w* State Initial |
|
1824 RWsSession rws; |
|
1825 TInt err = rws.Connect(); |
|
1826 CleanupClosePushL(rws); |
|
1827 TEST(err==KErrNone); |
|
1828 |
|
1829 rws.EnableWindowSizeCacheL(); |
|
1830 |
|
1831 RWindowGroup wg(rws); |
|
1832 wg.Construct(0); |
|
1833 CleanupClosePushL(rws); |
|
1834 |
|
1835 // w1 State 0 |
|
1836 RWindow w1(rws); |
|
1837 w1.Construct(wg,1); |
|
1838 CleanupClosePushL(w1); |
|
1839 |
|
1840 // w1 State 0 |
|
1841 TSize size1 (10001,123); |
|
1842 w1.SetSize(size1); |
|
1843 rws.Flush(); |
|
1844 |
|
1845 // w1 State 1 |
|
1846 TSize retSize1 = w1.Size(); |
|
1847 TEST(retSize1 == size1); |
|
1848 |
|
1849 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1850 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1851 TEST(retSizeForEgl1 == size1); |
|
1852 #endif |
|
1853 |
|
1854 // w1 State 2 |
|
1855 TSize size2 (20002,223); |
|
1856 w1.SetSize(size2); |
|
1857 |
|
1858 // Only the first call to EnableWindowSizeCacheL() should have an effect |
|
1859 // All subsequent calls to EnableWindowSizeCacheL() should have no effect |
|
1860 rws.EnableWindowSizeCacheL(); |
|
1861 |
|
1862 // w1 State 1 |
|
1863 TSize retSize2 = w1.Size(); |
|
1864 TEST(retSize2 == size2); |
|
1865 |
|
1866 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1867 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1868 TEST(retSizeForEgl2 == size2); |
|
1869 #endif |
|
1870 |
|
1871 // w1 State Final |
|
1872 CleanupStack::Pop(); |
|
1873 w1.Close(); |
|
1874 |
|
1875 CleanupStack::Pop(); |
|
1876 wg.Close(); |
|
1877 |
|
1878 CleanupStack::Pop(); |
|
1879 rws.Close(); |
|
1880 |
|
1881 __UHEAP_MARKEND; |
|
1882 } |
|
1883 |
|
1884 //------------------------------------------------------------------------------------------ |
|
1885 |
|
1886 void CTWindowSizeCacheTest::TestRBlankWindowSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1887 { |
|
1888 __UHEAP_MARK; |
|
1889 // w* State Initial |
|
1890 RWsSession rws; |
|
1891 TInt err = rws.Connect(); |
|
1892 CleanupClosePushL(rws); |
|
1893 TEST(err==KErrNone); |
|
1894 |
|
1895 if (aEnableWindowSizeCache) |
|
1896 { |
|
1897 rws.EnableWindowSizeCacheL(); |
|
1898 } |
|
1899 |
|
1900 RWindowGroup wg(rws); |
|
1901 err = wg.Construct(0); |
|
1902 CleanupClosePushL(rws); |
|
1903 TEST(err==KErrNone); |
|
1904 |
|
1905 // w1 State 0 |
|
1906 RBlankWindow w1(rws); |
|
1907 err = w1.Construct(wg,1); |
|
1908 CleanupClosePushL(w1); |
|
1909 TEST(err==KErrNone); |
|
1910 |
|
1911 // w1 State 0 |
|
1912 TSize size1 (10001,123); |
|
1913 w1.SetSize(size1); |
|
1914 rws.Flush(); |
|
1915 |
|
1916 // w1 State 1 |
|
1917 TSize retSize1 = w1.Size(); |
|
1918 TEST(retSize1 == size1); |
|
1919 |
|
1920 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1921 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
1922 TEST(retSizeForEgl1 == size1); |
|
1923 #endif |
|
1924 |
|
1925 // w1 State 2 |
|
1926 TSize size2 (20002,223); |
|
1927 w1.SetSize(size2); |
|
1928 |
|
1929 // w1 State 2 |
|
1930 TPoint point3 (30303,232); |
|
1931 TSize size3 (30003,323); |
|
1932 w1.SetExtent(point3, size3); |
|
1933 rws.Flush(); |
|
1934 |
|
1935 // w1 State 1 |
|
1936 TSize retSize2 = w1.Size(); |
|
1937 TEST(retSize2 == size3); |
|
1938 |
|
1939 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1940 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
1941 TEST(retSizeForEgl2 == size3); |
|
1942 #endif |
|
1943 |
|
1944 // w1 State 2 |
|
1945 TSize size4 (40004,423); |
|
1946 w1.SetSize(size4); |
|
1947 |
|
1948 // w1 State 1 |
|
1949 TSize retSize3 = w1.Size(); |
|
1950 TEST(retSize3 == size4); |
|
1951 |
|
1952 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
1953 TSize retSizeForEgl3 = w1.SizeForEgl(); |
|
1954 TEST(retSizeForEgl3 == size4); |
|
1955 #endif |
|
1956 |
|
1957 // w1 State Final |
|
1958 CleanupStack::Pop(); |
|
1959 w1.Close(); |
|
1960 |
|
1961 CleanupStack::Pop(); |
|
1962 wg.Close(); |
|
1963 |
|
1964 CleanupStack::Pop(); |
|
1965 rws.Close(); |
|
1966 |
|
1967 __UHEAP_MARKEND; |
|
1968 } |
|
1969 |
|
1970 //------------------------------------------------------------------------------------------ |
|
1971 |
|
1972 void CTWindowSizeCacheTest::TestRBackedUpWindowSetSizeErrSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache) |
|
1973 { |
|
1974 __UHEAP_MARK; |
|
1975 // w* State Initial |
|
1976 RWsSession rws; |
|
1977 TInt err = rws.Connect(); |
|
1978 CleanupClosePushL(rws); |
|
1979 TEST(err==KErrNone); |
|
1980 |
|
1981 if (aEnableWindowSizeCache) |
|
1982 { |
|
1983 rws.EnableWindowSizeCacheL(); |
|
1984 } |
|
1985 |
|
1986 RWindowGroup wg(rws); |
|
1987 err = wg.Construct(0); |
|
1988 CleanupClosePushL(rws); |
|
1989 TEST(err==KErrNone); |
|
1990 |
|
1991 // w1 State 0 |
|
1992 RBlankWindow w1(rws); |
|
1993 err = w1.Construct(wg,1); |
|
1994 CleanupClosePushL(w1); |
|
1995 TEST(err==KErrNone); |
|
1996 |
|
1997 // w1 State 0 |
|
1998 TSize size1 (10001,123); |
|
1999 err = w1.SetSizeErr(size1); |
|
2000 TEST(err==KErrNone); |
|
2001 |
|
2002 // w1 State 1 |
|
2003 TSize retSize1 = w1.Size(); |
|
2004 TEST(retSize1 == size1); |
|
2005 |
|
2006 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2007 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
2008 TEST(retSizeForEgl1 == size1); |
|
2009 #endif |
|
2010 |
|
2011 // w1 State 2 |
|
2012 TSize size2 (20002,223); |
|
2013 err = w1.SetSizeErr(size2); |
|
2014 TEST(err==KErrNone); |
|
2015 |
|
2016 // w1 State 2 |
|
2017 TPoint point3 (30303,232); |
|
2018 TSize size3 (30003,323); |
|
2019 err = w1.SetExtentErr(point3, size3); |
|
2020 TEST(err==KErrNone); |
|
2021 |
|
2022 // w1 State 1 |
|
2023 TSize retSize2 = w1.Size(); |
|
2024 TEST(retSize2 == size3); |
|
2025 |
|
2026 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2027 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
2028 TEST(retSizeForEgl2 == size3); |
|
2029 #endif |
|
2030 |
|
2031 // w1 State 2 |
|
2032 TSize size4 (40004,423); |
|
2033 err = w1.SetSizeErr(size4); |
|
2034 TEST(err==KErrNone); |
|
2035 |
|
2036 // w1 State 1 |
|
2037 TSize retSize3 = w1.Size(); |
|
2038 TEST(retSize3 == size4); |
|
2039 |
|
2040 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2041 TSize retSizeForEgl3 = w1.SizeForEgl(); |
|
2042 TEST(retSizeForEgl3 == size4); |
|
2043 #endif |
|
2044 |
|
2045 // w1 State Final |
|
2046 CleanupStack::Pop(); |
|
2047 w1.Close(); |
|
2048 |
|
2049 CleanupStack::Pop(); |
|
2050 wg.Close(); |
|
2051 |
|
2052 CleanupStack::Pop(); |
|
2053 rws.Close(); |
|
2054 |
|
2055 __UHEAP_MARKEND; |
|
2056 } |
|
2057 |
|
2058 //------------------------------------------------------------------------------------------ |
|
2059 |
|
2060 TUint64 CTWindowSizeCacheTest::TestRWindowSizePerformanceL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations) |
|
2061 { |
|
2062 TUint64 timeDeltaMicroSeconds = 0; |
|
2063 |
|
2064 __UHEAP_MARK; |
|
2065 // w* State Initial |
|
2066 RWsSession rws; |
|
2067 TInt err = rws.Connect(); |
|
2068 TEST(KErrNone == err); |
|
2069 CleanupClosePushL(rws); |
|
2070 |
|
2071 if (ETestSizeCacheEnabled == aEnableWindowSizeCache) |
|
2072 { |
|
2073 rws.EnableWindowSizeCacheL(); |
|
2074 } |
|
2075 |
|
2076 RWindowGroup wg(rws); |
|
2077 err = wg.Construct(0); |
|
2078 TEST(KErrNone == err); |
|
2079 CleanupClosePushL(wg); |
|
2080 |
|
2081 // w1 State 0 |
|
2082 RWindow w1(rws); |
|
2083 err = w1.Construct(wg,1); |
|
2084 TEST(KErrNone == err); |
|
2085 CleanupClosePushL(w1); |
|
2086 |
|
2087 TSize size1 (10001,123); |
|
2088 w1.SetSize(size1); |
|
2089 |
|
2090 TTime start; |
|
2091 TTime end; |
|
2092 start.UniversalTime(); |
|
2093 for (TUint iter = 0; iter < aIterations; ++iter) |
|
2094 { |
|
2095 // w1 State 1 |
|
2096 TSize retSize1 = w1.Size(); |
|
2097 TEST(retSize1 == size1); |
|
2098 |
|
2099 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2100 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
2101 TEST(retSizeForEgl1 == size1); |
|
2102 #endif |
|
2103 } |
|
2104 end.UniversalTime(); |
|
2105 |
|
2106 TTimeIntervalMicroSeconds delta = end.MicroSecondsFrom(start); |
|
2107 timeDeltaMicroSeconds = delta.Int64(); |
|
2108 INFO_PRINTF4(_L("TestRWindowSizePerformanceL - WindowSizeCacheEnabled %d, Iterations %d, Microseconds %Ld"), aEnableWindowSizeCache, aIterations, timeDeltaMicroSeconds); |
|
2109 |
|
2110 // w1 State Final |
|
2111 CleanupStack::Pop(); |
|
2112 w1.Close(); |
|
2113 |
|
2114 CleanupStack::Pop(); |
|
2115 wg.Close(); |
|
2116 |
|
2117 CleanupStack::Pop(); |
|
2118 rws.Close(); |
|
2119 |
|
2120 __UHEAP_MARKEND; |
|
2121 return timeDeltaMicroSeconds; |
|
2122 } |
|
2123 |
|
2124 |
|
2125 //------------------------------------------------------------------------------------------ |
|
2126 /* |
|
2127 Sets the random seed used by CTWindowSizeCacheTest::NextRandom. |
|
2128 */ |
|
2129 void CTWindowSizeCacheTest::SetRandomSeed(TInt64 aSeed) |
|
2130 { |
|
2131 INFO_PRINTF2(_L("Random Seed - %d"), aSeed); |
|
2132 iSeed = aSeed; |
|
2133 } |
|
2134 |
|
2135 /* |
|
2136 Performs an action on RWindow or RWsSession as specified by TRWindowAction aAction. |
|
2137 When the size of the window is changed, aExpectedSize is changed to the size we expect the window to be the next time RWindow::Size is called. |
|
2138 When RWindow::Size is called, we check the size returned matches aExpectedSize. |
|
2139 If aAction requests RWsSession::EnableWindowSizeCache, we call this if TSizeCacheStatus allows this. |
|
2140 |
|
2141 This function was designed for use with random stress tests, with a pseudo-random sequence driving TRWindowAction. |
|
2142 */ |
|
2143 void CTWindowSizeCacheTest::RWindowPerformAction(TRWindowAction aAction, TSizeCacheStatus aEnableWindowSizeCache, RWsSession& aWs, RWindow& aWindow, TSize& aExpectedSize) |
|
2144 { |
|
2145 switch (aAction) |
|
2146 { |
|
2147 case ESetExtent : |
|
2148 { |
|
2149 TPoint point(NextRandom(), NextRandom()); |
|
2150 aExpectedSize.iHeight = NextRandom(); |
|
2151 aExpectedSize.iWidth = NextRandom(); |
|
2152 aWindow.SetExtent(point, aExpectedSize); |
|
2153 aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight; |
|
2154 aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth; |
|
2155 } |
|
2156 break; |
|
2157 case ESetExtentErr : |
|
2158 { |
|
2159 TPoint point(NextRandom(), NextRandom()); |
|
2160 aExpectedSize.iHeight = NextRandom(); |
|
2161 aExpectedSize.iWidth = NextRandom(); |
|
2162 TInt err = aWindow.SetExtentErr(point, aExpectedSize); |
|
2163 TEST(KErrNone == err); |
|
2164 aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight; |
|
2165 aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth; |
|
2166 } |
|
2167 break; |
|
2168 case ESetSize : |
|
2169 { |
|
2170 aExpectedSize.iHeight = NextRandom(); |
|
2171 aExpectedSize.iWidth = NextRandom(); |
|
2172 aWindow.SetSize(aExpectedSize); |
|
2173 aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight; |
|
2174 aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth; |
|
2175 } |
|
2176 break; |
|
2177 case ESetSizeErr : |
|
2178 { |
|
2179 aExpectedSize.iHeight = NextRandom(); |
|
2180 aExpectedSize.iWidth = NextRandom(); |
|
2181 TInt err = aWindow.SetSizeErr(aExpectedSize); |
|
2182 TEST(KErrNone == err); |
|
2183 aExpectedSize.iHeight = (aExpectedSize.iHeight < 0) ? 0 : aExpectedSize.iHeight; |
|
2184 aExpectedSize.iWidth = (aExpectedSize.iWidth < 0) ? 0 : aExpectedSize.iWidth; |
|
2185 } |
|
2186 break; |
|
2187 case ECheckSize : |
|
2188 { |
|
2189 TSize retSize1 = aWindow.Size(); |
|
2190 TEST(retSize1 == aExpectedSize); |
|
2191 |
|
2192 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2193 TSize retSizeForEgl1 = aWindow.SizeForEgl(); |
|
2194 TEST(retSizeForEgl1 == aExpectedSize); |
|
2195 #endif |
|
2196 } |
|
2197 break; |
|
2198 case EFlushSession : |
|
2199 { |
|
2200 aWs.Flush(); |
|
2201 } |
|
2202 break; |
|
2203 case EEnableWindowSizeCache : |
|
2204 { |
|
2205 if (ETestSizeCacheEnabled == aEnableWindowSizeCache) |
|
2206 { |
|
2207 aWs.EnableWindowSizeCacheL(); |
|
2208 } |
|
2209 } |
|
2210 break; |
|
2211 default : |
|
2212 break; |
|
2213 } |
|
2214 } |
|
2215 |
|
2216 void CTWindowSizeCacheTest::TestRandomisedStressL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations) |
|
2217 { |
|
2218 __UHEAP_MARK; |
|
2219 // w* State Initial |
|
2220 RWsSession rws; |
|
2221 TInt err = rws.Connect(); |
|
2222 TEST(KErrNone == err); |
|
2223 CleanupClosePushL(rws); |
|
2224 |
|
2225 if (aEnableWindowSizeCache) |
|
2226 { |
|
2227 rws.EnableWindowSizeCacheL(); |
|
2228 } |
|
2229 |
|
2230 RWindowGroup wg(rws); |
|
2231 err = wg.Construct(0); |
|
2232 TEST(KErrNone == err); |
|
2233 CleanupClosePushL(wg); |
|
2234 |
|
2235 // w1 State 0 |
|
2236 RWindow w1(rws); |
|
2237 err = w1.Construct(wg,1); |
|
2238 TEST(KErrNone == err); |
|
2239 CleanupClosePushL(w1); |
|
2240 |
|
2241 TSize size1 (10001,123); |
|
2242 w1.SetSize(size1); |
|
2243 |
|
2244 for (TUint iter = 0; iter < aIterations; ++iter) |
|
2245 { |
|
2246 TRWindowAction action = static_cast<TRWindowAction>(NextRandom(EMaxAction)); |
|
2247 RWindowPerformAction(action, aEnableWindowSizeCache, rws, w1, size1); |
|
2248 } |
|
2249 |
|
2250 // w1 State Final |
|
2251 CleanupStack::Pop(); |
|
2252 w1.Close(); |
|
2253 |
|
2254 CleanupStack::Pop(); |
|
2255 wg.Close(); |
|
2256 |
|
2257 CleanupStack::Pop(); |
|
2258 rws.Close(); |
|
2259 __UHEAP_MARKEND; |
|
2260 } |
|
2261 |
|
2262 /* |
|
2263 TCleanupOperation for a window pool, implemented as RPointerArray<RWindow>. |
|
2264 */ |
|
2265 void CTWindowSizeCacheTest::CleanupWindowPool(TAny* aPtr) |
|
2266 { |
|
2267 RPointerArray<RWindow> windowPool = *(static_cast<RPointerArray<RWindow>*>(aPtr)); |
|
2268 const TUint poolSize = windowPool.Count(); |
|
2269 // Note: ResetAndDestroy deletes referenced objects, so no need to delete items in loop |
|
2270 for (TUint iter = 0; iter < poolSize; ++iter) |
|
2271 { |
|
2272 windowPool[iter]->Close(); |
|
2273 } |
|
2274 windowPool.ResetAndDestroy(); |
|
2275 } |
|
2276 |
|
2277 void CTWindowSizeCacheTest::TestRandomisedStressMultiSessionL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations) |
|
2278 { |
|
2279 __UHEAP_MARK; |
|
2280 // w* State Initial |
|
2281 RWsSession rws1; |
|
2282 TInt err = rws1.Connect(); |
|
2283 TEST(KErrNone == err); |
|
2284 CleanupClosePushL(rws1); |
|
2285 |
|
2286 // Multiple sessions in one thread |
|
2287 RWsSession rws2; |
|
2288 err = rws2.Connect(); |
|
2289 TEST(KErrNone == err); |
|
2290 CleanupClosePushL(rws2); |
|
2291 |
|
2292 RWindowGroup rws1_wg1(rws1); |
|
2293 err = rws1_wg1.Construct(0); |
|
2294 CleanupClosePushL(rws1_wg1); |
|
2295 TEST(KErrNone == err); |
|
2296 |
|
2297 RWindowGroup rws2_wg1(rws2); |
|
2298 err = rws2_wg1.Construct(0); |
|
2299 CleanupClosePushL(rws2_wg1); |
|
2300 TEST(KErrNone == err); |
|
2301 |
|
2302 // Multiple window groups in one session |
|
2303 RWindowGroup rws2_wg2(rws2); |
|
2304 err = rws2_wg2.Construct(1); |
|
2305 CleanupClosePushL(rws2_wg2); |
|
2306 TEST(KErrNone == err); |
|
2307 |
|
2308 // Window pool for all windows owned by session rws1 |
|
2309 RPointerArray<RWindow> rws1_windowPool; |
|
2310 CleanupStack::PushL(TCleanupItem(CleanupWindowPool,&rws1_windowPool)); |
|
2311 // Each window in window pool has a corresponding expected size at corresponding array index |
|
2312 RArray<TSize> rws1_expectedSizePool; |
|
2313 CleanupClosePushL(rws1_expectedSizePool); |
|
2314 |
|
2315 // Window pool for all windows owned by session rws2 |
|
2316 RPointerArray<RWindow> rws2_windowPool; |
|
2317 CleanupStack::PushL(TCleanupItem(CleanupWindowPool,&rws2_windowPool)); |
|
2318 // Each window in window pool has a corresponding expected size at corresponding array index |
|
2319 RArray<TSize> rws2_expectedSizePool; |
|
2320 CleanupClosePushL(rws2_expectedSizePool); |
|
2321 |
|
2322 // Populate window pool |
|
2323 const TUint KWindowCount_rws1_wg1 = 50; |
|
2324 const TUint KWindowCount_rws2_wg1 = 50; |
|
2325 const TUint KWindowCount_rws2_wg2 = 50; |
|
2326 |
|
2327 // Windows for session 1 belonging to rws1_wg1 |
|
2328 // Many windows - siblings |
|
2329 for (TUint iter = 0; iter < KWindowCount_rws1_wg1; ++iter) |
|
2330 { |
|
2331 RWindow* win = new (ELeave) RWindow(rws1); |
|
2332 CleanupStack::PushL(win); |
|
2333 TInt err = win->Construct(rws1_wg1,iter+1); |
|
2334 TEST(KErrNone == err); |
|
2335 rws1_windowPool.AppendL(win); |
|
2336 CleanupStack::Pop(win); |
|
2337 TSize expectedSize (NextRandom(),NextRandom()); |
|
2338 win->SetSize(expectedSize); |
|
2339 // Wserv flattens size to zero |
|
2340 expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight; |
|
2341 expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth; |
|
2342 rws1_expectedSizePool.AppendL(expectedSize); |
|
2343 TSize retSize1 = win->Size(); |
|
2344 TEST(retSize1 == expectedSize); |
|
2345 |
|
2346 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2347 TSize retSizeForEgl1 = win->SizeForEgl(); |
|
2348 TEST(retSizeForEgl1 == expectedSize); |
|
2349 #endif |
|
2350 } |
|
2351 |
|
2352 // Windows for session 2 belonging to rws2_wg1 |
|
2353 // Many windows - siblings |
|
2354 for (TUint iter = 0; iter < KWindowCount_rws2_wg1; ++iter) |
|
2355 { |
|
2356 RWindow* win = new (ELeave) RWindow(rws2); |
|
2357 CleanupStack::PushL(win); |
|
2358 TInt err = win->Construct(rws2_wg1,iter+2); |
|
2359 TEST(KErrNone == err); |
|
2360 rws2_windowPool.AppendL(win); |
|
2361 CleanupStack::Pop(); |
|
2362 TSize expectedSize (NextRandom(),NextRandom()); |
|
2363 win->SetSize(expectedSize); |
|
2364 // Wserv flattens size to zero |
|
2365 expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight; |
|
2366 expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth; |
|
2367 rws2_expectedSizePool.AppendL(expectedSize); |
|
2368 TSize retSize1 = win->Size(); |
|
2369 TEST(retSize1 == expectedSize); |
|
2370 |
|
2371 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2372 TSize retSizeForEgl1 = win->SizeForEgl(); |
|
2373 TEST(retSizeForEgl1 == expectedSize); |
|
2374 #endif |
|
2375 } |
|
2376 |
|
2377 // Windows for session 2 belonging to rws2_wg2 |
|
2378 // Many windows - children |
|
2379 RWindowTreeNode parent = rws2_wg2; |
|
2380 for (TUint iter = 0; iter < KWindowCount_rws2_wg2; ++iter) |
|
2381 { |
|
2382 RWindow* win = new (ELeave) RWindow(rws2); |
|
2383 CleanupStack::PushL(win); |
|
2384 TInt err = win->Construct(parent,KWindowCount_rws2_wg1+iter+2); |
|
2385 TEST(KErrNone == err); |
|
2386 parent = *win; |
|
2387 rws2_windowPool.AppendL(win); |
|
2388 CleanupStack::Pop(); |
|
2389 TSize expectedSize (NextRandom(),NextRandom()); |
|
2390 win->SetSize(expectedSize); |
|
2391 // Wserv flattens size to zero |
|
2392 expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight; |
|
2393 expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth; |
|
2394 rws2_expectedSizePool.AppendL(expectedSize); |
|
2395 TSize retSize1 = win->Size(); |
|
2396 TEST(retSize1 == expectedSize); |
|
2397 |
|
2398 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2399 TSize retSizeForEgl1 = win->SizeForEgl(); |
|
2400 TEST(retSizeForEgl1 == expectedSize); |
|
2401 #endif |
|
2402 } |
|
2403 |
|
2404 // Stress system by performing actions on windows |
|
2405 for (TUint iter = 0; iter < aIterations; ++iter) |
|
2406 { |
|
2407 TRWindowAction action = static_cast<TRWindowAction>(NextRandom(EMaxAction)); |
|
2408 TUint32 windowPool = NextRandom(2); |
|
2409 switch (windowPool) |
|
2410 { |
|
2411 case 0 : |
|
2412 { |
|
2413 TUint32 target = NextRandom(rws1_windowPool.Count()); |
|
2414 RWindowPerformAction(action, aEnableWindowSizeCache, rws1, *(rws1_windowPool[target]) , rws1_expectedSizePool[target]); |
|
2415 } |
|
2416 break; |
|
2417 case 1 : |
|
2418 { |
|
2419 TUint32 target = NextRandom(rws2_windowPool.Count()); |
|
2420 RWindowPerformAction(action, aEnableWindowSizeCache, rws2, *(rws2_windowPool[target]) , rws2_expectedSizePool[target]); |
|
2421 } |
|
2422 break; |
|
2423 default : |
|
2424 User::Invariant(); |
|
2425 } |
|
2426 } |
|
2427 |
|
2428 |
|
2429 // Cleanup afterwards |
|
2430 CleanupStack::Pop(9); |
|
2431 |
|
2432 CleanupWindowPool(&rws1_windowPool); |
|
2433 rws1_expectedSizePool.Close(); |
|
2434 rws1_wg1.Close(); |
|
2435 rws1.Close(); |
|
2436 |
|
2437 CleanupWindowPool(&rws2_windowPool); |
|
2438 rws2_expectedSizePool.Close(); |
|
2439 rws2_wg1.Close(); |
|
2440 rws2_wg2.Close(); |
|
2441 rws2.Close(); |
|
2442 } |
|
2443 |
|
2444 void CTWindowSizeCacheTest::TestRandomisedStressCacheEntryVolumeL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations, TUint aWindowPoolSize) |
|
2445 { |
|
2446 __UHEAP_MARK; |
|
2447 // w* State Initial |
|
2448 RWsSession rws1; |
|
2449 TInt err = rws1.Connect(); |
|
2450 TEST(KErrNone == err); |
|
2451 CleanupClosePushL(rws1); |
|
2452 |
|
2453 if (aEnableWindowSizeCache) |
|
2454 { |
|
2455 rws1.EnableWindowSizeCacheL(); |
|
2456 } |
|
2457 |
|
2458 RWindowGroup rws1_wg1(rws1); |
|
2459 err = rws1_wg1.Construct(0); |
|
2460 TEST(KErrNone == err); |
|
2461 CleanupClosePushL(rws1_wg1); |
|
2462 |
|
2463 RPointerArray<RWindow> windowPool; |
|
2464 CleanupStack::PushL(TCleanupItem(CleanupWindowPool,&windowPool)); |
|
2465 // Each window in window pool has a corresponding expected size at corresponding array index |
|
2466 RArray<TSize> expectedSizePool; |
|
2467 CleanupClosePushL(expectedSizePool); |
|
2468 |
|
2469 // Populate window pool |
|
2470 for (TUint iter = 0; iter < aWindowPoolSize; ++iter) |
|
2471 { |
|
2472 RWindow* win = new (ELeave) RWindow(rws1); |
|
2473 CleanupStack::PushL(win); |
|
2474 TInt err = win->Construct(rws1_wg1,iter+1); |
|
2475 TEST(KErrNone == err); |
|
2476 windowPool.AppendL(win); |
|
2477 CleanupStack::Pop(win); |
|
2478 |
|
2479 TSize expectedSize (NextRandom(),NextRandom()); |
|
2480 win->SetSize(expectedSize); |
|
2481 // Wserv flattens size to zero |
|
2482 expectedSize.iHeight = (expectedSize.iHeight < 0) ? 0 : expectedSize.iHeight; |
|
2483 expectedSize.iWidth = (expectedSize.iWidth < 0) ? 0 : expectedSize.iWidth; |
|
2484 expectedSizePool.AppendL(expectedSize); |
|
2485 TSize retSize1 = win->Size(); |
|
2486 TEST(retSize1 == expectedSize); |
|
2487 |
|
2488 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2489 TSize retSizeForEgl1 = win->SizeForEgl(); |
|
2490 TEST(retSizeForEgl1 == expectedSize); |
|
2491 #endif |
|
2492 } |
|
2493 |
|
2494 // Stress system by performing actions on windows |
|
2495 for (TUint iter = 0; iter < aIterations; ++iter) |
|
2496 { |
|
2497 TRWindowAction action = static_cast<TRWindowAction>(NextRandom(EMaxAction)); |
|
2498 TUint32 target = NextRandom(aWindowPoolSize); |
|
2499 RWindowPerformAction(action, aEnableWindowSizeCache, rws1, *(windowPool[target]), expectedSizePool[target]); |
|
2500 } |
|
2501 |
|
2502 // Cleanup afterwards |
|
2503 CleanupStack::Pop(4); |
|
2504 |
|
2505 CleanupWindowPool(&windowPool); |
|
2506 expectedSizePool.Close(); |
|
2507 rws1_wg1.Close(); |
|
2508 rws1.Close(); |
|
2509 |
|
2510 __UHEAP_MARKEND; |
|
2511 } |
|
2512 |
|
2513 //------------------------------------------------------------------------------------------ |
|
2514 |
|
2515 void CTWindowSizeCacheTest::TestStressEnableWindowSizeCacheL(TUint aIterations) |
|
2516 { |
|
2517 __UHEAP_MARK; |
|
2518 // w* State Initial |
|
2519 RWsSession rws; |
|
2520 TInt err = rws.Connect(); |
|
2521 CleanupClosePushL(rws); |
|
2522 TEST(err==KErrNone); |
|
2523 |
|
2524 // Only the first call to EnableWindowSizeCacheL() should have an effect |
|
2525 // All subsequent calls to EnableWindowSizeCacheL() should have no effect |
|
2526 for (TUint iter = 0; iter < aIterations; iter++) |
|
2527 { |
|
2528 rws.EnableWindowSizeCacheL(); |
|
2529 } |
|
2530 |
|
2531 RWindowGroup wg(rws); |
|
2532 wg.Construct(0); |
|
2533 CleanupClosePushL(rws); |
|
2534 |
|
2535 // w1 State 0 |
|
2536 RWindow w1(rws); |
|
2537 w1.Construct(wg,1); |
|
2538 CleanupClosePushL(w1); |
|
2539 |
|
2540 TSize size1 (10001,123); |
|
2541 w1.SetSize(size1); |
|
2542 |
|
2543 // w1 State 1 |
|
2544 TSize retSize1 = w1.Size(); |
|
2545 TEST(retSize1 == size1); |
|
2546 |
|
2547 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2548 TSize retSizeForEgl1 = w1.SizeForEgl(); |
|
2549 TEST(retSizeForEgl1 == size1); |
|
2550 #endif |
|
2551 |
|
2552 // w1 State 2 |
|
2553 TSize size2 (20002,223); |
|
2554 w1.SetSize(size2); |
|
2555 |
|
2556 // w1 State 2 |
|
2557 // Only the first call to EnableWindowSizeCacheL() should have an effect |
|
2558 // All subsequent calls to EnableWindowSizeCacheL() should have no effect |
|
2559 for (TUint iter = 0; iter < aIterations; iter++) |
|
2560 { |
|
2561 rws.EnableWindowSizeCacheL(); |
|
2562 } |
|
2563 |
|
2564 // w1 State 1 |
|
2565 TSize retSize2 = w1.Size(); |
|
2566 TEST(retSize2 == size2); |
|
2567 |
|
2568 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
|
2569 TSize retSizeForEgl2 = w1.SizeForEgl(); |
|
2570 TEST(retSizeForEgl2 == size2); |
|
2571 #endif |
|
2572 |
|
2573 // w1 State Final |
|
2574 CleanupStack::Pop(); |
|
2575 w1.Close(); |
|
2576 |
|
2577 CleanupStack::Pop(); |
|
2578 wg.Close(); |
|
2579 |
|
2580 CleanupStack::Pop(); |
|
2581 rws.Close(); |
|
2582 |
|
2583 __UHEAP_MARKEND; |
|
2584 } |
|
2585 |
|
2586 /* |
|
2587 Tests 701-706 focus on window creation operating correctly, alternating use of the window size cache. |
|
2588 Tests 707-710 aim to cover state transitions for cache entries in the window size cache for RWindow. |
|
2589 Tests 711-712 performs basic verification of size related functionality for RBlankWindow and RBackedUpWindow. |
|
2590 Test 713 focusses on ensuring a performance gain is achieved with window size caching enabled. |
|
2591 Tests 714-720 aim to stress the window size cache with pseudo-random sequences of RWindow size related functions. |
|
2592 |
|
2593 The states in the state machine model used for testing the RWindow size cache in tests 707-710 is as follows: |
|
2594 |
|
2595 State: Initial |
|
2596 Window not yet in existence |
|
2597 |
|
2598 State 0: No Cache entry |
|
2599 Window created, window size cache does not contain an entry for this window |
|
2600 |
|
2601 State 1: Cache entry exists, cache clean |
|
2602 Window created, window size cache exists, contains a valid size |
|
2603 |
|
2604 State 2: Cache entry exists, cache dirty |
|
2605 Window created, window size cache exists, does not contain a valid size |
|
2606 |
|
2607 State: Final |
|
2608 Window destroyed |
|
2609 */ |
|
2610 void CTWindowSizeCacheTest::RunTestCaseL(TInt /*aCurTestCase*/) |
|
2611 { |
|
2612 _LIT(KTest1,"Create RWindow, window size cache off"); |
|
2613 _LIT(KTest2,"Create RWindow, window size cache on"); |
|
2614 _LIT(KTest3,"Create RBlankWindow, window size cache off"); |
|
2615 _LIT(KTest4,"Create RBlankWindow, window size cache on"); |
|
2616 _LIT(KTest5,"Create RBackedUpWindow, window size cache off"); |
|
2617 _LIT(KTest6,"Create RBackedUpWindow, window size cache on"); |
|
2618 |
|
2619 _LIT(KTest7,"RWindow - No cache entry"); |
|
2620 _LIT(KTest8,"RWindow - Cache entry exists, cache clean"); |
|
2621 _LIT(KTest9,"RWindow - Cache entry exists, cache dirty"); |
|
2622 _LIT(KTest10,"RWindow - Cache entry exists, cache dirty->clean"); |
|
2623 |
|
2624 _LIT(KTest11,"RBlankWindow size cache"); |
|
2625 _LIT(KTest12,"RBackedUpWindow size cache"); |
|
2626 |
|
2627 _LIT(KTest13,"RWindow Size Performance"); |
|
2628 _LIT(KTest14,"RWindow Randomised Stress window size cache off"); |
|
2629 _LIT(KTest15,"RWindow Randomised Stress window size cache on"); |
|
2630 _LIT(KTest16,"RWindow Randomised Stress MultiSession cache off"); |
|
2631 _LIT(KTest17,"RWindow Randomised Stress MultiSession cache on"); |
|
2632 _LIT(KTest18,"RWindow Randomised Stress Entry Volume cache off"); |
|
2633 _LIT(KTest19,"RWindow Randomised Stress Entry Volume cache on"); |
|
2634 _LIT(KTest20,"RWsSession stress EnableWindowSizeCacheL"); |
|
2635 |
|
2636 const TDisplayMode displayMode = EColor16MAP; |
|
2637 const TUint KPerformanceIterations = 50000; |
|
2638 const TUint KStressTestIterations = 3000; |
|
2639 const TUint KStressWindowPoolSize = 100; |
|
2640 |
|
2641 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
2642 |
|
2643 switch(++iTest->iState) |
|
2644 { |
|
2645 /** |
|
2646 @SYMTestCaseID GRAPHICS-WSERV-0701 |
|
2647 |
|
2648 @SYMDEF DevCR BBRE-7UWGHL |
|
2649 |
|
2650 @SYMTestCaseDesc Test creation and destruction for instances of RWindow, window size cache off |
|
2651 |
|
2652 @SYMTestPriority High |
|
2653 |
|
2654 @SYMTestStatus Implemented |
|
2655 |
|
2656 @SYMTestActions Creates an RWsSession, some RWindowGroup and RWindow instances, and closes them. |
|
2657 |
|
2658 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2659 */ |
|
2660 case 1: |
|
2661 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0701")); |
|
2662 iTest->LogSubTest(KTest1); |
|
2663 TestCreateRWindowL(ETestSizeCacheNotEnabled); |
|
2664 break; |
|
2665 /** |
|
2666 @SYMTestCaseID GRAPHICS-WSERV-0702 |
|
2667 |
|
2668 @SYMDEF DevCR BBRE-7UWGHL |
|
2669 |
|
2670 @SYMTestCaseDesc Test creation and destruction for instances of RWindow, window size cache on |
|
2671 |
|
2672 @SYMTestPriority High |
|
2673 |
|
2674 @SYMTestStatus Implemented |
|
2675 |
|
2676 @SYMTestActions Creates an RWsSession, enables window size cache, creates some RWindowGroup and RWindow instances, and closes them. |
|
2677 |
|
2678 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2679 */ |
|
2680 case 2: |
|
2681 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0702")); |
|
2682 iTest->LogSubTest(KTest2); |
|
2683 TestCreateRWindowL(ETestSizeCacheEnabled); |
|
2684 break; |
|
2685 /** |
|
2686 @SYMTestCaseID GRAPHICS-WSERV-0703 |
|
2687 |
|
2688 @SYMDEF DevCR BBRE-7UWGHL |
|
2689 |
|
2690 @SYMTestCaseDesc Test creation and destruction for instances of RBlankWindow, window size cache off |
|
2691 |
|
2692 @SYMTestPriority High |
|
2693 |
|
2694 @SYMTestStatus Implemented |
|
2695 |
|
2696 @SYMTestActions Creates an RWsSession, creates some RWindowGroup and RBlankWindow instances, and closes them. |
|
2697 |
|
2698 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2699 */ |
|
2700 case 3: |
|
2701 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0703")); |
|
2702 iTest->LogSubTest(KTest3); |
|
2703 TestCreateRBlankWindowL(ETestSizeCacheNotEnabled); |
|
2704 break; |
|
2705 /** |
|
2706 @SYMTestCaseID GRAPHICS-WSERV-0704 |
|
2707 |
|
2708 @SYMDEF DevCR BBRE-7UWGHL |
|
2709 |
|
2710 @SYMTestCaseDesc Test creation and destruction for instances of RBlankWindow, window size cache on |
|
2711 |
|
2712 @SYMTestPriority High |
|
2713 |
|
2714 @SYMTestStatus Implemented |
|
2715 |
|
2716 @SYMTestActions Creates an RWsSession, enables window size cache, creates some RWindowGroup and RBlankWindow instances, and closes them. |
|
2717 |
|
2718 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2719 */ |
|
2720 case 4: |
|
2721 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0704")); |
|
2722 iTest->LogSubTest(KTest4); |
|
2723 TestCreateRBlankWindowL(ETestSizeCacheEnabled); |
|
2724 break; |
|
2725 /** |
|
2726 @SYMTestCaseID GRAPHICS-WSERV-0705 |
|
2727 |
|
2728 @SYMDEF DevCR BBRE-7UWGHL |
|
2729 |
|
2730 @SYMTestCaseDesc Test creation and destruction for instances of RBackedUpWindow, window size cache off |
|
2731 |
|
2732 @SYMTestPriority High |
|
2733 |
|
2734 @SYMTestStatus Implemented |
|
2735 |
|
2736 @SYMTestActions Creates an RWsSession, creates some RWindowGroup and RBackedUpWindow instances, and closes them. |
|
2737 |
|
2738 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2739 */ |
|
2740 case 5: |
|
2741 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0705")); |
|
2742 iTest->LogSubTest(KTest5); |
|
2743 TestCreateRBackedUpWindowL(ETestSizeCacheNotEnabled, displayMode); |
|
2744 break; |
|
2745 /** |
|
2746 @SYMTestCaseID GRAPHICS-WSERV-0706 |
|
2747 |
|
2748 @SYMDEF DevCR BBRE-7UWGHL |
|
2749 |
|
2750 @SYMTestCaseDesc Test creation and destruction for instances of RBackedUpWindow, window size cache on |
|
2751 |
|
2752 @SYMTestPriority High |
|
2753 |
|
2754 @SYMTestStatus Implemented |
|
2755 |
|
2756 @SYMTestActions Creates an RWsSession, enables window size cache, creates some RWindowGroup and RBackedUpWindow instances, and closes them. |
|
2757 |
|
2758 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2759 */ |
|
2760 case 6: |
|
2761 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0706")); |
|
2762 iTest->LogSubTest(KTest6); |
|
2763 TestCreateRBackedUpWindowL(ETestSizeCacheEnabled, displayMode); |
|
2764 break; |
|
2765 /** |
|
2766 @SYMTestCaseID GRAPHICS-WSERV-0707 |
|
2767 |
|
2768 @SYMDEF DevCR BBRE-7UWGHL |
|
2769 |
|
2770 @SYMTestCaseDesc Test RWindow size cache - State: No Cache Entry |
|
2771 |
|
2772 @SYMTestPriority High |
|
2773 |
|
2774 @SYMTestStatus Implemented |
|
2775 |
|
2776 @SYMTestActions Perform the following with window size cache on and off: |
|
2777 Create RWsSession, creates RWindowGroup and RWindow. |
|
2778 Perform one of SetExtent/SetSize/SetExtentErr/SetSizeErr/EnableWindowSizeCacheL. |
|
2779 Clean up. |
|
2780 |
|
2781 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2782 */ |
|
2783 case 7: |
|
2784 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0707")); |
|
2785 iTest->LogSubTest(KTest7); |
|
2786 TestRWindowNoCacheEntryL(ETestSizeCacheNotEnabled); |
|
2787 TestRWindowNoCacheEntryL(ETestSizeCacheEnabled); |
|
2788 TestRWindowNoCacheEntrySetExtentErrL(ETestSizeCacheNotEnabled); |
|
2789 TestRWindowNoCacheEntrySetExtentErrL(ETestSizeCacheEnabled); |
|
2790 TestRWindowNoCacheEntrySetSizeErrL(ETestSizeCacheNotEnabled); |
|
2791 TestRWindowNoCacheEntrySetSizeErrL(ETestSizeCacheEnabled); |
|
2792 TestRWindowNoCacheEntrySetExtentL(ETestSizeCacheNotEnabled); |
|
2793 TestRWindowNoCacheEntrySetExtentL(ETestSizeCacheEnabled); |
|
2794 TestRWindowNoCacheEntrySetSizeL(ETestSizeCacheNotEnabled); |
|
2795 TestRWindowNoCacheEntrySetSizeL(ETestSizeCacheEnabled); |
|
2796 TestRWindowNoCacheEntryEnableWindowSizeCacheL(); |
|
2797 break; |
|
2798 |
|
2799 /** |
|
2800 @SYMTestCaseID GRAPHICS-WSERV-0708 |
|
2801 |
|
2802 @SYMDEF DevCR BBRE-7UWGHL |
|
2803 |
|
2804 @SYMTestCaseDesc Test RWindow size cache State: Cache entry exists, cache clean |
|
2805 |
|
2806 @SYMTestPriority High |
|
2807 |
|
2808 @SYMTestStatus Implemented |
|
2809 |
|
2810 @SYMTestActions Perform the following with window size cache on and off: |
|
2811 Create RWsSession, creates RWindowGroup and RWindow, calls SetSize. |
|
2812 Perform one of Size/EnableWindowSizeCacheL. |
|
2813 Check that size returned matches expected size. |
|
2814 Clean up. |
|
2815 |
|
2816 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2817 */ |
|
2818 case 8: |
|
2819 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0708")); |
|
2820 iTest->LogSubTest(KTest8); |
|
2821 TestRWindowCacheEntryExistsCacheCleanL(ETestSizeCacheNotEnabled); |
|
2822 TestRWindowCacheEntryExistsCacheCleanL(ETestSizeCacheEnabled); |
|
2823 TestRWindowCacheEntryExistsCacheCleanSizeL(ETestSizeCacheNotEnabled); |
|
2824 TestRWindowCacheEntryExistsCacheCleanSizeL(ETestSizeCacheEnabled); |
|
2825 TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheL(); |
|
2826 TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheLSizeL(); |
|
2827 break; |
|
2828 |
|
2829 /** |
|
2830 @SYMTestCaseID GRAPHICS-WSERV-0709 |
|
2831 |
|
2832 @SYMDEF DevCR BBRE-7UWGHL |
|
2833 |
|
2834 @SYMTestCaseDesc Test RWindow size cache State: Cache entry exists, cache dirty |
|
2835 |
|
2836 @SYMTestPriority High |
|
2837 |
|
2838 @SYMTestStatus Implemented |
|
2839 |
|
2840 @SYMTestActions Perform the following with window size cache on and off: |
|
2841 Create RWsSession, creates RWindowGroup and RWindow. |
|
2842 Calls SetSize, Size, then SetSize to enter state with dirty cache entry. |
|
2843 Perform combinations of SetSize/SetExtent/SetSizeErr/SetExtentErr/EnableWindowSizeCacheL. |
|
2844 Check that size returned matches the last size set on the window whenever size is queried. |
|
2845 Clean up. |
|
2846 |
|
2847 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2848 */ |
|
2849 case 9: |
|
2850 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0709")); |
|
2851 iTest->LogSubTest(KTest9); |
|
2852 TestRWindowCacheEntryExistsCacheDirtySetSizeL(ETestSizeCacheNotEnabled); |
|
2853 TestRWindowCacheEntryExistsCacheDirtySetSizeL(ETestSizeCacheEnabled); |
|
2854 TestRWindowCacheEntryExistsCacheDirtySetExtentL(ETestSizeCacheNotEnabled); |
|
2855 TestRWindowCacheEntryExistsCacheDirtySetExtentL(ETestSizeCacheEnabled); |
|
2856 TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(ETestSizeCacheNotEnabled); |
|
2857 TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(ETestSizeCacheEnabled); |
|
2858 TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(ETestSizeCacheNotEnabled); |
|
2859 TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(ETestSizeCacheEnabled); |
|
2860 TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(ETestSizeCacheNotEnabled); |
|
2861 TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(ETestSizeCacheEnabled); |
|
2862 TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(ETestSizeCacheNotEnabled); |
|
2863 TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(ETestSizeCacheEnabled); |
|
2864 TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(ETestSizeCacheNotEnabled); |
|
2865 TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(ETestSizeCacheEnabled); |
|
2866 TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(ETestSizeCacheNotEnabled); |
|
2867 TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(ETestSizeCacheEnabled); |
|
2868 TestRWindowCacheEntryExistsCacheDirtySetSizeEnableWindowSizeCacheL(); |
|
2869 break; |
|
2870 |
|
2871 |
|
2872 /** |
|
2873 @SYMTestCaseID GRAPHICS-WSERV-0710 |
|
2874 |
|
2875 @SYMDEF DevCR BBRE-7UWGHL |
|
2876 |
|
2877 @SYMTestCaseDesc Test RWindow size cache State: Cache entry exists, cache dirty -> State: Cache entry exists, cache clean |
|
2878 |
|
2879 @SYMTestPriority High |
|
2880 |
|
2881 @SYMTestStatus Implemented |
|
2882 |
|
2883 @SYMTestActions Perform the following with window size cache on and off: |
|
2884 Create RWsSession, creates RWindowGroup and RWindow. |
|
2885 Calls SetSize, Size, to enter state with clean cache entry. |
|
2886 Perform combinations of SetSize/SetExtent/SetSizeErr/SetExtentErr/EnableWindowSizeCacheL to enter state with dirty cache entry. |
|
2887 Calls RWindow::Size to re-enter state with clean cache entry. |
|
2888 Check that size returned matches the last size set on the window whenever size is queried. |
|
2889 Clean up. |
|
2890 |
|
2891 @SYMTestExpectedResults Window objects created successfully, no memory leaks. |
|
2892 */ |
|
2893 case 10: |
|
2894 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0710")); |
|
2895 iTest->LogSubTest(KTest10); |
|
2896 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(ETestSizeCacheNotEnabled); |
|
2897 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(ETestSizeCacheEnabled); |
|
2898 TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(ETestSizeCacheNotEnabled); |
|
2899 TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(ETestSizeCacheEnabled); |
|
2900 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(ETestSizeCacheNotEnabled); |
|
2901 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(ETestSizeCacheEnabled); |
|
2902 TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(ETestSizeCacheNotEnabled); |
|
2903 TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(ETestSizeCacheEnabled); |
|
2904 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(ETestSizeCacheNotEnabled); |
|
2905 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(ETestSizeCacheEnabled); |
|
2906 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(ETestSizeCacheNotEnabled); |
|
2907 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(ETestSizeCacheEnabled); |
|
2908 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(ETestSizeCacheNotEnabled); |
|
2909 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(ETestSizeCacheEnabled); |
|
2910 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(ETestSizeCacheNotEnabled); |
|
2911 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(ETestSizeCacheEnabled); |
|
2912 TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeEnableWindowSizeCacheL(); |
|
2913 break; |
|
2914 |
|
2915 /** |
|
2916 @SYMTestCaseID GRAPHICS-WSERV-0711 |
|
2917 |
|
2918 @SYMDEF DevCR BBRE-7UWGHL |
|
2919 |
|
2920 @SYMTestCaseDesc Test RBlankWindow Size cache behaviour |
|
2921 |
|
2922 @SYMTestPriority High |
|
2923 |
|
2924 @SYMTestStatus Implemented |
|
2925 |
|
2926 @SYMTestActions Utilises RBlankWindow::SetSize, RBlankWindow::SetExtent, RBlankWindow::Size. |
|
2927 Checks size returned by RBlankWindow::Size. |
|
2928 Cleans up. |
|
2929 |
|
2930 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size returned should be last size set on window |
|
2931 */ |
|
2932 case 11: |
|
2933 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0711")); |
|
2934 iTest->LogSubTest(KTest11); |
|
2935 TestRBlankWindowSetSizeSetExtentL(ETestSizeCacheNotEnabled); |
|
2936 TestRBlankWindowSetSizeSetExtentL(ETestSizeCacheEnabled); |
|
2937 break; |
|
2938 /** |
|
2939 @SYMTestCaseID GRAPHICS-WSERV-0712 |
|
2940 |
|
2941 @SYMDEF DevCR BBRE-7UWGHL |
|
2942 |
|
2943 @SYMTestCaseDesc Test RBackedUpWindow Size cache behaviour |
|
2944 |
|
2945 @SYMTestPriority High |
|
2946 |
|
2947 @SYMTestStatus Implemented |
|
2948 |
|
2949 @SYMTestActions Utilises RBackedUpWindow::SetSizeErr, RBackedUpWindow::SetExtentErr, RBackedUpWindow::Size. |
|
2950 Checks size returned by RBackedUpWindow::Size. |
|
2951 Cleans up. |
|
2952 |
|
2953 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size returned should be last size set on window |
|
2954 */ |
|
2955 case 12: |
|
2956 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0712")); |
|
2957 iTest->LogSubTest(KTest12); |
|
2958 TestRBackedUpWindowSetSizeErrSetExtentErrL(ETestSizeCacheNotEnabled); |
|
2959 TestRBackedUpWindowSetSizeErrSetExtentErrL(ETestSizeCacheEnabled); |
|
2960 break; |
|
2961 |
|
2962 /** |
|
2963 @SYMTestCaseID GRAPHICS-WSERV-0713 |
|
2964 |
|
2965 @SYMDEF DevCR BBRE-7UWGHL |
|
2966 |
|
2967 @SYMTestCaseDesc Compare performance of RWindow::Size function with size cache on and off |
|
2968 |
|
2969 @SYMTestPriority High |
|
2970 |
|
2971 @SYMTestStatus Implemented |
|
2972 |
|
2973 @SYMTestActions Creates an RWsSession, optionally enables window size cache, creates an RWindowGroup and an RWindow |
|
2974 Calls RWindow::Size KPerformanceIterations times. |
|
2975 Measures time taken - with and without size cache enabled |
|
2976 |
|
2977 @SYMTestExpectedResults Window objects created successfully, no memory leaks, time taken for KPerformanceIterations RWindow::Size() calls with cache enabled should be faster. |
|
2978 */ |
|
2979 case 13: |
|
2980 { |
|
2981 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0713")); |
|
2982 iTest->LogSubTest(KTest13); |
|
2983 TUint64 sizeCacheOffDeltaMicroSeconds = TestRWindowSizePerformanceL(ETestSizeCacheNotEnabled, KPerformanceIterations); |
|
2984 TUint64 sizeCacheOnDeltaMicroSeconds = TestRWindowSizePerformanceL(ETestSizeCacheEnabled, KPerformanceIterations); |
|
2985 TEST(sizeCacheOnDeltaMicroSeconds < sizeCacheOffDeltaMicroSeconds); |
|
2986 INFO_PRINTF1(_L("Accessing size using cache is faster")); |
|
2987 } |
|
2988 break; |
|
2989 /** |
|
2990 @SYMTestCaseID GRAPHICS-WSERV-0714 |
|
2991 |
|
2992 @SYMDEF DevCR BBRE-7UWGHL |
|
2993 |
|
2994 @SYMTestCaseDesc Randomised stress test - RWindow size related functions |
|
2995 |
|
2996 @SYMTestPriority High |
|
2997 |
|
2998 @SYMTestStatus Implemented |
|
2999 |
|
3000 @SYMTestActions Creates an RWsSession, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up. |
|
3001 |
|
3002 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window |
|
3003 */ |
|
3004 case 14: |
|
3005 { |
|
3006 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0714")); |
|
3007 iTest->LogSubTest(KTest14); |
|
3008 TInt seed = Math::Random(); |
|
3009 // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed |
|
3010 SetRandomSeed(seed); |
|
3011 TestRandomisedStressL(ETestSizeCacheNotEnabled, KStressTestIterations); |
|
3012 } |
|
3013 break; |
|
3014 /** |
|
3015 @SYMTestCaseID GRAPHICS-WSERV-0714 |
|
3016 |
|
3017 @SYMDEF DevCR BBRE-7UWGHL |
|
3018 |
|
3019 @SYMTestCaseDesc Randomised stress test - RWindow size related functions, size cache on |
|
3020 |
|
3021 @SYMTestPriority High |
|
3022 |
|
3023 @SYMTestStatus Implemented |
|
3024 |
|
3025 @SYMTestActions Creates an RWsSession, enables window size cache, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up. |
|
3026 |
|
3027 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window |
|
3028 */ |
|
3029 case 15: |
|
3030 { |
|
3031 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0715")); |
|
3032 iTest->LogSubTest(KTest15); |
|
3033 TInt seed = Math::Random(); |
|
3034 // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed |
|
3035 SetRandomSeed(seed); |
|
3036 TestRandomisedStressL(ETestSizeCacheEnabled, KStressTestIterations); |
|
3037 } |
|
3038 break; |
|
3039 |
|
3040 |
|
3041 /** |
|
3042 @SYMTestCaseID GRAPHICS-WSERV-0716 |
|
3043 |
|
3044 @SYMDEF DevCR BBRE-7UWGHL |
|
3045 |
|
3046 @SYMTestCaseDesc Randomised stress test - RWindow size related functions, multiple sessions |
|
3047 |
|
3048 @SYMTestPriority High |
|
3049 |
|
3050 @SYMTestStatus Implemented |
|
3051 |
|
3052 @SYMTestActions Creates two RWsSession instances, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up. |
|
3053 |
|
3054 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window |
|
3055 */ |
|
3056 case 16: |
|
3057 { |
|
3058 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0716")); |
|
3059 iTest->LogSubTest(KTest16); |
|
3060 TInt seed = Math::Random(); |
|
3061 // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed |
|
3062 SetRandomSeed(seed); |
|
3063 TestRandomisedStressMultiSessionL(ETestSizeCacheNotEnabled, KStressTestIterations); |
|
3064 } |
|
3065 break; |
|
3066 /** |
|
3067 @SYMTestCaseID GRAPHICS-WSERV-0717 |
|
3068 |
|
3069 @SYMDEF DevCR BBRE-7UWGHL |
|
3070 |
|
3071 @SYMTestCaseDesc Randomised stress test - RWindow size related functions, multiple sessions, size cache on |
|
3072 |
|
3073 @SYMTestPriority High |
|
3074 |
|
3075 @SYMTestStatus Implemented |
|
3076 |
|
3077 @SYMTestActions Creates two RWsSession instances, enables window size cache, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up. |
|
3078 |
|
3079 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window |
|
3080 */ |
|
3081 case 17: |
|
3082 { |
|
3083 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0717")); |
|
3084 iTest->LogSubTest(KTest17); |
|
3085 TInt seed = Math::Random(); |
|
3086 // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed |
|
3087 SetRandomSeed(seed); |
|
3088 TestRandomisedStressMultiSessionL(ETestSizeCacheEnabled, KStressTestIterations); |
|
3089 } |
|
3090 break; |
|
3091 |
|
3092 /** |
|
3093 @SYMTestCaseID GRAPHICS-WSERV-0718 |
|
3094 |
|
3095 @SYMDEF DevCR BBRE-7UWGHL |
|
3096 |
|
3097 @SYMTestCaseDesc Randomised stress test - RWindow size related functions, large number of windows |
|
3098 |
|
3099 @SYMTestPriority High |
|
3100 |
|
3101 @SYMTestStatus Implemented |
|
3102 |
|
3103 @SYMTestActions Creates an RWsSession, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up. |
|
3104 |
|
3105 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window |
|
3106 */ |
|
3107 case 18: |
|
3108 { |
|
3109 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0718")); |
|
3110 iTest->LogSubTest(KTest18); |
|
3111 TInt seed = Math::Random(); |
|
3112 // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed |
|
3113 SetRandomSeed(seed); |
|
3114 TestRandomisedStressCacheEntryVolumeL(ETestSizeCacheNotEnabled, KStressTestIterations, KStressWindowPoolSize); |
|
3115 } |
|
3116 break; |
|
3117 /** |
|
3118 @SYMTestCaseID GRAPHICS-WSERV-0719 |
|
3119 |
|
3120 @SYMDEF DevCR BBRE-7UWGHL |
|
3121 |
|
3122 @SYMTestCaseDesc Randomised stress test - RWindow size related functions, large number of windows |
|
3123 |
|
3124 @SYMTestPriority High |
|
3125 |
|
3126 @SYMTestStatus Implemented |
|
3127 |
|
3128 @SYMTestActions Creates an RWsSession, enables window size cache, creates some RWindowGroup and RWindow instances, performs random size related actions, cleans up. |
|
3129 |
|
3130 @SYMTestExpectedResults Window objects created successfully, no memory leaks, size for each window matches last size set on window |
|
3131 */ |
|
3132 case 19: |
|
3133 { |
|
3134 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0719")); |
|
3135 iTest->LogSubTest(KTest19); |
|
3136 TInt seed = Math::Random(); |
|
3137 // To replicate a test run, take the random seed from the test log and pass into SetRandomSeed |
|
3138 SetRandomSeed(seed); |
|
3139 TestRandomisedStressCacheEntryVolumeL(ETestSizeCacheEnabled, KStressTestIterations, KStressWindowPoolSize); |
|
3140 } |
|
3141 break; |
|
3142 |
|
3143 /** |
|
3144 @SYMTestCaseID GRAPHICS-WSERV-0720 |
|
3145 |
|
3146 @SYMDEF DevCR BBRE-7UWGHL |
|
3147 |
|
3148 @SYMTestCaseDesc Test RWsSession::EnableWindowSizeCacheL() API |
|
3149 |
|
3150 @SYMTestPriority High |
|
3151 |
|
3152 @SYMTestStatus Implemented |
|
3153 |
|
3154 @SYMTestActions Creates an RWsSession, calls EnableWindowSizeCacheL() multiple times, uses Size related APIs. |
|
3155 |
|
3156 @SYMTestExpectedResults No memory leaks. |
|
3157 */ |
|
3158 case 20: |
|
3159 { |
|
3160 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0720")); |
|
3161 iTest->LogSubTest(KTest20); |
|
3162 TestStressEnableWindowSizeCacheL(KStressTestIterations); |
|
3163 } |
|
3164 break; |
|
3165 default: |
|
3166 ((CTWindowSizeCacheTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
3167 ((CTWindowSizeCacheTestStep*)iStep)->CloseTMSGraphicsStep(); |
|
3168 TestComplete(); |
|
3169 break; |
|
3170 } |
|
3171 ((CTWindowSizeCacheTestStep*)iStep)->RecordTestResultL(); |
|
3172 } |
|
3173 |
|
3174 __WS_CONSTRUCT_STEP__(WindowSizeCacheTest) |