|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #ifndef __TWINDOWSIZECACHE_H__ |
|
23 #define __TWINDOWSIZECACHE_H__ |
|
24 |
|
25 #include <e32std.h> |
|
26 #include <w32std.h> |
|
27 #include "AUTO.H" |
|
28 |
|
29 #include "../nga/CLIENT/w32comm.h" |
|
30 |
|
31 #include "../tlib/testbase.h" |
|
32 #include "TGraphicsHarness.h" |
|
33 |
|
34 //----------------------------------------------------------- |
|
35 class CTWindowSizeCacheTest : public CTWsGraphicsBase |
|
36 { |
|
37 public: |
|
38 enum TSizeCacheStatus |
|
39 { |
|
40 ETestSizeCacheNotEnabled, |
|
41 ETestSizeCacheEnabled, |
|
42 }; |
|
43 enum TRWindowAction |
|
44 { |
|
45 ESetExtent, |
|
46 ESetExtentErr, |
|
47 ESetSize, |
|
48 ESetSizeErr, |
|
49 ECheckSize, |
|
50 EFlushSession, |
|
51 EEnableWindowSizeCache, |
|
52 EMaxAction, |
|
53 }; |
|
54 public: |
|
55 CTWindowSizeCacheTest(CTestStep* aStep); |
|
56 ~CTWindowSizeCacheTest(); |
|
57 TestState DoTestL(); |
|
58 void ConstructL(); |
|
59 // |
|
60 void TestCreateRWindowL(TSizeCacheStatus aEnableWindowSizeCache); |
|
61 void TestCreateRBlankWindowL(TSizeCacheStatus aEnableWindowSizeCache); |
|
62 void TestCreateRBackedUpWindowL(TSizeCacheStatus aEnableWindowSizeCache, TDisplayMode aDisplayMode); |
|
63 // |
|
64 void TestRWindowNoCacheEntryL(TSizeCacheStatus aEnableWindowSizeCache); |
|
65 void TestRWindowNoCacheEntrySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
66 void TestRWindowNoCacheEntrySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
67 void TestRWindowNoCacheEntrySetExtentL(TSizeCacheStatus aEnableWindowSizeCache); |
|
68 void TestRWindowNoCacheEntrySetSizeL(TSizeCacheStatus aEnableWindowSizeCache); |
|
69 void TestRWindowNoCacheEntryEnableWindowSizeCacheL(); |
|
70 // |
|
71 void TestRWindowCacheEntryExistsCacheCleanL(TSizeCacheStatus aEnableWindowSizeCache); |
|
72 void TestRWindowCacheEntryExistsCacheCleanSizeL(TSizeCacheStatus aEnableWindowSizeCache); |
|
73 void TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheL(); |
|
74 void TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheLSizeL(); |
|
75 // |
|
76 void TestRWindowCacheEntryExistsCacheDirtySetSizeL(TSizeCacheStatus aEnableWindowSizeCache); |
|
77 void TestRWindowCacheEntryExistsCacheDirtySetExtentL(TSizeCacheStatus aEnableWindowSizeCache); |
|
78 void TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
79 void TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
80 void TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache); |
|
81 void TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache); |
|
82 void TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
83 void TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
84 void TestRWindowCacheEntryExistsCacheDirtySetSizeEnableWindowSizeCacheL(); |
|
85 // |
|
86 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(TSizeCacheStatus aEnableWindowSizeCache); |
|
87 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(TSizeCacheStatus aEnableWindowSizeCache); |
|
88 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
89 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
90 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache); |
|
91 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache); |
|
92 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
93 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
94 void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeEnableWindowSizeCacheL(); |
|
95 // |
|
96 void TestRBlankWindowSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache); |
|
97 void TestRBackedUpWindowSetSizeErrSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache); |
|
98 // |
|
99 void SetRandomSeed(TInt64 aSeed); |
|
100 inline TInt NextRandom(TUint aMax = 0); |
|
101 // |
|
102 TUint64 TestRWindowSizePerformanceL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations); |
|
103 // |
|
104 static void CleanupWindowPool(TAny* aPtr); |
|
105 void RWindowPerformAction(TRWindowAction aAction, TSizeCacheStatus aEnableWindowSizeCache, RWsSession& aWs, RWindow& aWindow, TSize& aExpectedSize); |
|
106 void TestRandomisedStressL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations); |
|
107 void TestRandomisedStressMultiSessionL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations); |
|
108 void TestRandomisedStressCacheEntryVolumeL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations, TUint aWindowPoolSize); |
|
109 void TestStressEnableWindowSizeCacheL(TUint aIterations); |
|
110 |
|
111 protected: |
|
112 //from CTGraphicsStep |
|
113 virtual void RunTestCaseL(TInt aCurTestCase); |
|
114 |
|
115 private: |
|
116 TInt64 iSeed; |
|
117 }; |
|
118 |
|
119 //----------------------------------------------------------- |
|
120 inline TInt CTWindowSizeCacheTest::NextRandom(TUint aMax) |
|
121 { |
|
122 TInt random = Math::Rand(iSeed); |
|
123 if (aMax != 0) |
|
124 { |
|
125 random = random % aMax; |
|
126 } |
|
127 return random; |
|
128 } |
|
129 |
|
130 //----------------------------------------------------------- |
|
131 class CTWindowSizeCacheTestStep : public CTGraphicsStep |
|
132 { |
|
133 public: |
|
134 CTWindowSizeCacheTestStep(); |
|
135 protected: |
|
136 //from CTGraphicsStep |
|
137 virtual CTGraphicsBase* CreateTestL(); |
|
138 }; |
|
139 |
|
140 _LIT(KTWindowSizeCacheTestStep,"TWindowSizeCacheTest"); |
|
141 |
|
142 //----------------------------------------------------------- |
|
143 #endif // TWINDOWSIZECACHE |