|
1 // Copyright (c) 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 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 |
|
25 #ifndef __TSURFACEUPDATEINTEG_H__ |
|
26 #define __TSURFACEUPDATEINTEG_H__ |
|
27 |
|
28 #include <test/testexecutestepbase.h> |
|
29 #include <test/tgraphicsharness.h> |
|
30 #include "surfaceupdateserver.h" |
|
31 #include "surfaceupdateclient.h" |
|
32 #include <graphics/surface.h> |
|
33 |
|
34 |
|
35 class CTWindowGroup; |
|
36 class CTWindowTreeNode; |
|
37 class CTRedrawHandler; |
|
38 class CSurfaceHelper; |
|
39 class CTWindow; |
|
40 |
|
41 /** |
|
42 * Main class for installing a test environment and running test cases. |
|
43 */ |
|
44 class CTSurfaceUpdateInteg : public CTGraphicsBase |
|
45 { |
|
46 public: |
|
47 CTSurfaceUpdateInteg(CTestStep* aStep); |
|
48 ~CTSurfaceUpdateInteg(); |
|
49 void ConstructL(); |
|
50 protected: |
|
51 //from CTGraphicsStep |
|
52 virtual void RunTestCaseL(TInt aCurTestCase); |
|
53 private: |
|
54 void TestCase1L(); |
|
55 void TestCase2L(); |
|
56 void TestCase3(); |
|
57 |
|
58 CTWindowGroup* CreateGroupL(CWsScreenDevice* aScreenDevice); |
|
59 void RegisterWindowL(CTWindowTreeNode* aWindow); |
|
60 TBool CompareAllScreens(); |
|
61 TBool Compare(TInt aScreenNumber, const TRect& aRectSrc, CFbsBitmap* aOriginalBitmap); |
|
62 void FillRefBitmap(TRgb aColor); |
|
63 private: |
|
64 TInt iNumOfScreens; |
|
65 RWsSession iWs; |
|
66 RSurfaceUpdateSession iSurfaceUpdate; |
|
67 |
|
68 RPointerArray <CWsScreenDevice> iWsDevs; |
|
69 RPointerArray <CWindowGc> iGcs; |
|
70 |
|
71 RPointerArray <CTWindowGroup> iGroups; |
|
72 RPointerArray <CTWindowTreeNode> iWindows; |
|
73 CTRedrawHandler* iRedrawHandler; |
|
74 CSurfaceHelper* iSurfaceHelper; |
|
75 TSurfaceId iSurface; //doesn't own |
|
76 TSurfaceId iSurfaceAbove; //doesn't own |
|
77 TSurfaceId iSurfaceAbove1; //bigger size, doesn't own |
|
78 TSurfaceId iSurfaceDoubleBuffered; //doesn't own |
|
79 RPointerArray<CFbsBitmap> iBitmaps; //the list of bitmaps where each bitmap corresponds to particular screen |
|
80 CTWindow *iWindowAbove1; //on first screen, doesn't own |
|
81 CTWindow *iWindowAbove11; //on first screen, bigger size, doesn't own |
|
82 CTWindow *iWindowAbove2; //on second screen, doesn't own |
|
83 CTWindow *iWindowSingleBuffured1; //on first screen, doesn't own |
|
84 CTWindow *iWindowSingleBuffured2; //on second screen, doesn't own |
|
85 CTWindow *iWindowDoubleBuffured1; //on first screen, doesn't own |
|
86 CTWindow *iWindowDoubleBuffured2; //on second screen, doesn't own |
|
87 |
|
88 |
|
89 CFbsBitmap* iRefBitmap; //used for comparison |
|
90 CFbsBitmapDevice* iBitmapDevice; |
|
91 CGraphicsContext* iGraphicsContext; |
|
92 }; |
|
93 |
|
94 class CTSurfaceUpdateIntegStep : public CTGraphicsStep |
|
95 { |
|
96 public: |
|
97 CTSurfaceUpdateIntegStep(); |
|
98 inline TBool IsScreenCaptureSupported() const; |
|
99 |
|
100 private: |
|
101 //from CTGraphicsStep |
|
102 virtual CTGraphicsBase* CreateTestL(); |
|
103 virtual void TestSetupL(); |
|
104 virtual void TestClose(); |
|
105 private: |
|
106 TBool iScreenCapture; //signifies if screen capture is supported or not |
|
107 }; |
|
108 |
|
109 inline TBool CTSurfaceUpdateIntegStep::IsScreenCaptureSupported() const |
|
110 { |
|
111 return iScreenCapture; |
|
112 } |
|
113 |
|
114 |
|
115 struct TSwitchDisplayAndReleaseBuffer |
|
116 { |
|
117 TInt iBuffer; //buffer for submission |
|
118 TInt iScreen; //screen to be connected/disconnected |
|
119 TSurfaceId iSurfaceId; |
|
120 }; |
|
121 |
|
122 /** |
|
123 * The class executes specified commands in a separate thread. |
|
124 * Will be used when a main thread is blocked and waits for notifications to arrive. |
|
125 */ |
|
126 class CCommandDispatcher : public CBase |
|
127 { |
|
128 public: |
|
129 enum CommandName |
|
130 { |
|
131 EDisconnectDisplayAndReleaseBuffer, |
|
132 EConnectDisplayAndReleaseBuffer |
|
133 }; |
|
134 CCommandDispatcher(CommandName aCommandName, TAny* aPram) : |
|
135 iCommandName(aCommandName), iParam(aPram){} |
|
136 TInt Start(); |
|
137 private: |
|
138 static TInt ThreadFunction(TAny*); |
|
139 void ExecuteCommandL(); |
|
140 private: |
|
141 CommandName iCommandName; |
|
142 TAny* iParam; |
|
143 }; |
|
144 |
|
145 _LIT(KTSurfaceUpdateIntegStep,"TSurfaceUpdateInteg"); |
|
146 |
|
147 |
|
148 #endif // __TSURFACEUPDATEINTEG_H__ |