|
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 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CTestPlatAlfVisual::TestAlfCtrlGroupResourceId |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TInt CTestPlatAlfVisual::TestAlfCurvePathNewL( CStifItemParser& /*aItem*/ ) |
|
34 { |
|
35 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
36 _LIT( KTestAlfCurvePathNewL, "TestAlfCurvePathNewL" ); |
|
37 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCurvePathNewL ); |
|
38 // Print to log file |
|
39 iLog->Log( KTestAlfCurvePathNewL ); |
|
40 |
|
41 CAlfCurvePath* vPath = CAlfCurvePath::NewL( *iAlfEnv ); |
|
42 CleanupStack::PushL( vPath ); |
|
43 STIF_ASSERT_NOT_NULL( vPath ); |
|
44 CleanupStack::PopAndDestroy( vPath ); |
|
45 |
|
46 vPath = NULL; |
|
47 vPath = CAlfCurvePath::NewLC( *iAlfEnv ); |
|
48 STIF_ASSERT_NOT_NULL( vPath ); |
|
49 CleanupStack::PopAndDestroy( vPath ); |
|
50 |
|
51 return KErrNone; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CTestPlatAlfVisual::TestAlfCurvePathLoopL |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 TInt CTestPlatAlfVisual::TestAlfCurvePathLoopL( CStifItemParser& /*aItem*/ ) |
|
59 { |
|
60 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
61 _LIT( KTestAlfCurvePathLoopL, "TestAlfCurvePathLoopL" ); |
|
62 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCurvePathLoopL ); |
|
63 // Print to log file |
|
64 iLog->Log( KTestAlfCurvePathLoopL ); |
|
65 |
|
66 CAlfCurvePath* vPath = CAlfCurvePath::NewL( *iAlfEnv ); |
|
67 CleanupStack::PushL( vPath ); |
|
68 vPath->EnableLoop( ETrue ); |
|
69 STIF_ASSERT_TRUE( vPath->Loop() ); |
|
70 vPath->EnableLoop( EFalse ); |
|
71 STIF_ASSERT_FALSE( vPath->Loop() ); |
|
72 CleanupStack::PopAndDestroy( vPath ); |
|
73 |
|
74 return KErrNone; |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CTestPlatAlfVisual::TestAlfCurvePathOffsetL |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 TInt CTestPlatAlfVisual::TestAlfCurvePathOffsetL( CStifItemParser& /*aItem*/ ) |
|
82 { |
|
83 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
84 _LIT( KTestAlfCurvePathOffsetL, "TestAlfCurvePathOffsetL" ); |
|
85 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCurvePathOffsetL ); |
|
86 // Print to log file |
|
87 iLog->Log( KTestAlfCurvePathOffsetL ); |
|
88 |
|
89 CAlfCurvePath* vPath = CAlfCurvePath::NewL( *iAlfEnv ); |
|
90 CleanupStack::PushL( vPath ); |
|
91 TAlfTimedPoint offset; |
|
92 offset.iX.SetValueNow( 0.5 ); |
|
93 offset.iY.SetValueNow( 0.6 ); |
|
94 vPath->SetOffset(offset); |
|
95 |
|
96 const TAlfTimedPoint& newOffSet = vPath->Offset(); |
|
97 STIF_ASSERT_EQUALS( (float)0.5, newOffSet.iX.ValueNow() ); |
|
98 STIF_ASSERT_EQUALS( (float)0.6, newOffSet.iY.ValueNow() ); |
|
99 CleanupStack::PopAndDestroy( vPath ); |
|
100 |
|
101 return KErrNone; |
|
102 } |
|
103 |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CTestPlatAlfVisual::TestAlfCurvePathProcessPointsL |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 TInt CTestPlatAlfVisual::TestAlfCurvePathProcessPointsL( CStifItemParser& /*aItem*/ ) |
|
110 { |
|
111 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
112 _LIT( KTestAlfCurvePathProcessPointsL, "TestAlfCurvePathProcessPointsL" ); |
|
113 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCurvePathProcessPointsL ); |
|
114 // Print to log file |
|
115 iLog->Log( KTestAlfCurvePathProcessPointsL ); |
|
116 |
|
117 CAlfCurvePath* vPath = CAlfCurvePath::NewL( *iAlfEnv ); |
|
118 CleanupStack::PushL( vPath ); |
|
119 TReal32 vRealnum = 0; |
|
120 TPoint vStartPoiont( 0, 0 ); |
|
121 TPoint vEndPoint( 1, 1 ); |
|
122 TSize vSize( 1, 1 ); |
|
123 TAlfRealSize vRealSize( 0.5, 0.5 ); |
|
124 TAlfRealPoint vRealStartPoint; |
|
125 TAlfRealPoint vRealEndPoint( vEndPoint ); |
|
126 vPath->SetOrigin( vRealnum ); |
|
127 |
|
128 vPath->AppendLineL( vStartPoiont, vEndPoint ); |
|
129 vPath->AppendLineL( vRealStartPoint, vRealEndPoint ); |
|
130 |
|
131 vPath->AppendArcL( vStartPoiont, vSize, 0.5, 0.5 ); |
|
132 vPath->AppendArcL( vRealStartPoint, vRealSize, 0.5, 0.5 ); |
|
133 STIF_ASSERT_NOT_EQUALS( (float)0.0, vPath->Length() ) |
|
134 vPath->MapValue( 0.5, 0 ); |
|
135 vPath->Evaluate( 0.4, vRealStartPoint ); |
|
136 CleanupStack::PopAndDestroy( vPath ); |
|
137 |
|
138 return KErrNone; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CTestPlatAlfVisual::TestAlfCurvePathResetL |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 TInt CTestPlatAlfVisual::TestAlfCurvePathResetL( CStifItemParser& /*aItem*/ ) |
|
146 { |
|
147 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
148 _LIT( KTestAlfCurvePathResetL, "TestAlfCurvePathResetL" ); |
|
149 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCurvePathResetL ); |
|
150 // Print to log file |
|
151 iLog->Log( KTestAlfCurvePathResetL ); |
|
152 |
|
153 CAlfCurvePath* vPath = CAlfCurvePath::NewL( *iAlfEnv ); |
|
154 CleanupStack::PushL( vPath ); |
|
155 vPath->Reset(); |
|
156 CleanupStack::PopAndDestroy( vPath ); |
|
157 |
|
158 return KErrNone; |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CTestPlatAlfVisual::TestAlfCurvePathMappingFunctionIdentifierL |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TInt CTestPlatAlfVisual::TestAlfCurvePathMappingFunctionIdentifierL( CStifItemParser& /*aItem*/ ) |
|
166 { |
|
167 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
168 _LIT( KTestAlfCurvePathMappingFunctionIdentifierL, "TestAlfCurvePathMappingFunctionIdentifierL" ); |
|
169 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfCurvePathMappingFunctionIdentifierL ); |
|
170 // Print to log file |
|
171 iLog->Log( KTestAlfCurvePathMappingFunctionIdentifierL ); |
|
172 |
|
173 CAlfCurvePath* vPath = CAlfCurvePath::NewL( *iAlfEnv ); |
|
174 CleanupStack::PushL( vPath ); |
|
175 vPath->MappingFunctionIdentifier(); |
|
176 CleanupStack::PopAndDestroy( vPath ); |
|
177 |
|
178 return KErrNone; |
|
179 } |
|
180 |
|
181 // End of file |
|
182 |
|
183 |