|
1 /* |
|
2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: test functions for alfvisual.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] |
|
21 #include <e32svr.h> |
|
22 #include <stifparser.h> |
|
23 #include <stiftestinterface.h> |
|
24 |
|
25 #include "testplatalfvisual.h" |
|
26 |
|
27 // CONSTANTS |
|
28 const TInt KBufSize = 64; |
|
29 |
|
30 // FORWARD DECLARATION |
|
31 /*This class test protected functions of CAlfMeshVisual*/ |
|
32 class CTestCAlfMeshVisual : public CAlfMeshVisual |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * C++ default constructor. |
|
37 */ |
|
38 CTestCAlfMeshVisual(); |
|
39 /** |
|
40 * Destructor. |
|
41 */ |
|
42 ~CTestCAlfMeshVisual(); |
|
43 /** |
|
44 * TestProtectedFuncForVisual test protected functions of CTestCAlfMeshVisual |
|
45 * @since S60 5.0 |
|
46 * @param aItem is not used. |
|
47 * @return Symbian OS error code. |
|
48 */ |
|
49 TInt TestProtectedFuncForVisual( CStifItemParser& aItem ); |
|
50 }; |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CTestCAlfMeshVisual::CTestCAlfMeshVisual |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CTestCAlfMeshVisual::CTestCAlfMeshVisual(){} |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CTestCAlfMeshVisual::~CTestCAlfMeshVisual |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CTestCAlfMeshVisual::~CTestCAlfMeshVisual(){} |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CTestCAlfMeshVisual::TestProtectedFuncForVisual |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 TInt CTestCAlfMeshVisual::TestProtectedFuncForVisual( CStifItemParser& /*aItem*/ ) |
|
69 { |
|
70 TUid vUid = { 0x00000000 }; |
|
71 PropertyOwnerExtension( vUid, NULL ); |
|
72 DoRemoveAndDestroyAllD(); |
|
73 return KErrNone; |
|
74 } |
|
75 // ============================ MEMBER FUNCTIONS =============================== |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CTestPlatAlfVisual::TestAlfMeshVisualFullConstructorL |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TInt CTestPlatAlfVisual::TestAlfMeshVisualFullConstructorL( CStifItemParser& /*aItem*/ ) |
|
82 { |
|
83 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
84 _LIT( KTestAlfMeshVisualFullConstructorL, "TestAlfMeshVisualFullConstructorL" ); |
|
85 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfMeshVisualFullConstructorL ); |
|
86 // Print to log file |
|
87 iLog->Log( KTestAlfMeshVisualFullConstructorL ); |
|
88 |
|
89 CAlfMeshVisual* vVisual = new ( ELeave ) CAlfMeshVisual; |
|
90 CleanupStack::PushL( vVisual ); |
|
91 STIF_ASSERT_NOT_NULL( vVisual ); |
|
92 vVisual->ConstructL( *iAlfCtl ); |
|
93 CleanupStack::PopAndDestroy( vVisual ); |
|
94 |
|
95 return KErrNone; |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CTestPlatAlfVisual::TestAlfMeshVisualAddNewL |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 TInt CTestPlatAlfVisual::TestAlfMeshVisualAddNewL( CStifItemParser& /*aItem*/ ) |
|
103 { |
|
104 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
105 _LIT( KTestAlfMeshVisualAddNewL, "TestAlfMeshVisualAddNewL" ); |
|
106 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfMeshVisualAddNewL ); |
|
107 // Print to log file |
|
108 iLog->Log( KTestAlfMeshVisualAddNewL ); |
|
109 |
|
110 CAlfMeshVisual* vVisual = CAlfMeshVisual::AddNewL( *iAlfCtl ); |
|
111 STIF_ASSERT_NOT_NULL( vVisual ); |
|
112 |
|
113 return KErrNone; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CTestPlatAlfVisual::TestAlfMeshVisualSetAndGetL |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 TInt CTestPlatAlfVisual::TestAlfMeshVisualSetAndGetL( CStifItemParser& /*aItem*/ ) |
|
121 { |
|
122 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
123 _LIT( KTestAlfMeshVisualSetAndGetL, "TestAlfMeshVisualSetAndGetL" ); |
|
124 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfMeshVisualSetAndGetL ); |
|
125 // Print to log file |
|
126 iLog->Log( KTestAlfMeshVisualSetAndGetL ); |
|
127 |
|
128 CAlfMeshVisual* vVisual = CAlfMeshVisual::AddNewL( *iAlfCtl ); |
|
129 vVisual->CreateMeshL( EAlfMeshTypeM3G ); |
|
130 TUid vUid = { 0x00000000 }; |
|
131 CAlfTextureManager* vTextManager = iAlfEnv->CreateSharedTextureManagerL( vUid ); |
|
132 const CAlfTexture* vText = vTextManager->Texture( 0 ); |
|
133 TAlfImage vImage( *vText ); |
|
134 vVisual->SetImage( vImage ); |
|
135 vVisual->Image(); |
|
136 TAlfImage vSecImage( vUid, EAknsAppIconTypeList, |
|
137 TSize( 1, 1), EAspectRatioPreserved, 0, 0, 0, 0 ); |
|
138 vVisual->SetSecondaryImage( vSecImage ); |
|
139 vVisual->SecondaryImage(); |
|
140 TUid vSecUid = { 0x00000001 }; |
|
141 TAlfImage vNewImage( vSecUid, EAknsAppIconTypeList, |
|
142 TSize( 1, 1), EAspectRatioPreserved, 0, 0, 0, 0 ); |
|
143 vVisual->SetSpecularImage( vNewImage ); |
|
144 vVisual->SpecularImage(); |
|
145 vVisual->Mesh(); |
|
146 vVisual->ProceduralMesh(); |
|
147 vVisual->M3GMesh(); |
|
148 const TAlfTimedValue vValue( 1 ); |
|
149 vVisual->SetSecondaryAlpha( vValue ); |
|
150 vVisual->SecondaryAlpha(); |
|
151 vVisual->SetYawAngle( vValue ); |
|
152 vVisual->YawAngle(); |
|
153 vVisual->SetPitchAngle( vValue ); |
|
154 vVisual->PitchAngle(); |
|
155 vVisual->SetScale( vValue ); |
|
156 vVisual->Scale(); |
|
157 |
|
158 return KErrNone; |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CTestPlatAlfVisual::TestAlfMeshVisualForVisualL |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TInt CTestPlatAlfVisual::TestAlfMeshVisualForVisualL( CStifItemParser& /*aItem*/ ) |
|
166 { |
|
167 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
168 _LIT( KTestAlfMeshVisualForVisualL, "TestAlfMeshVisualForVisualL" ); |
|
169 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfMeshVisualForVisualL ); |
|
170 // Print to log file |
|
171 iLog->Log( KTestAlfMeshVisualForVisualL ); |
|
172 |
|
173 CAlfMeshVisual* vVisual = CAlfMeshVisual::AddNewL( *iAlfCtl ); |
|
174 _LIT8( KTest, "tset" ); |
|
175 TBuf8<KBufSize> vBuf( KTest ); |
|
176 vVisual->FindTag( vBuf ); |
|
177 vVisual->UpdateChildrenLayout(); |
|
178 vVisual->RemoveAndDestroyAllD(); |
|
179 |
|
180 return KErrNone; |
|
181 } |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CTestPlatAlfVisual::TestAlfMeshVisualProtectedFuncL |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 TInt CTestPlatAlfVisual::TestAlfMeshVisualProtectedFuncL( CStifItemParser& aItem ) |
|
188 { |
|
189 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
190 _LIT( KTestAlfMeshVisualProtectedFuncL, "TestAlfMeshVisualProtectedFuncL" ); |
|
191 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfMeshVisualProtectedFuncL ); |
|
192 // Print to log file |
|
193 iLog->Log( KTestAlfMeshVisualProtectedFuncL ); |
|
194 |
|
195 CTestCAlfMeshVisual* vMeshVisual = new ( ELeave ) CTestCAlfMeshVisual; |
|
196 CleanupStack::PushL( vMeshVisual ); |
|
197 vMeshVisual->ConstructL( *iAlfCtl ); |
|
198 vMeshVisual->TestProtectedFuncForVisual( aItem ); |
|
199 CleanupStack::Pop( vMeshVisual ); |
|
200 |
|
201 return KErrNone; |
|
202 } |
|
203 |
|
204 // End of file |
|
205 |