|
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: For test alf core toolkit api modules |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <uiacceltk/huiGradientBrush.h> |
|
20 |
|
21 #include "testuiaifcoretoolkit.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // Ctestplatalfcoretoolkit::TestHuiGradientBrushNewLL |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushNewLL( CStifItemParser& /*aItem*/ ) |
|
28 { |
|
29 |
|
30 // Print to UI |
|
31 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
32 _LIT( KTestHuiGradientBrushNewLL, "TestHuiGradientBrushNewLL" ); |
|
33 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushNewLL ); |
|
34 // Print to log file |
|
35 iLog->Log( KTestHuiGradientBrushNewLL ); |
|
36 |
|
37 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewL(); |
|
38 CleanupStack::PushL( huiGradientBrush ); |
|
39 STIF_ASSERT_NOT_NULL( huiGradientBrush ); |
|
40 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
41 |
|
42 return KErrNone; |
|
43 |
|
44 } |
|
45 // ----------------------------------------------------------------------------- |
|
46 // Ctestplatalfcoretoolkit::TestHuiGradientBrushNewLCL |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushNewLCL( CStifItemParser& /*aItem*/ ) |
|
50 { |
|
51 |
|
52 // Print to UI |
|
53 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
54 _LIT( KTestHuiGradientBrushNewLCL, "TestHuiGradientBrushNewLCL" ); |
|
55 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushNewLCL ); |
|
56 // Print to log file |
|
57 iLog->Log( KTestHuiGradientBrushNewLCL ); |
|
58 |
|
59 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
60 STIF_ASSERT_NOT_NULL( huiGradientBrush ); |
|
61 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
62 |
|
63 return KErrNone; |
|
64 |
|
65 } |
|
66 // ----------------------------------------------------------------------------- |
|
67 // Ctestplatalfcoretoolkit::TestHuiGradientBrushSetDirectionL |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushSetDirectionL( CStifItemParser& /*aItem*/ ) |
|
71 { |
|
72 |
|
73 // Print to UI |
|
74 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
75 _LIT( KTestHuiGradientBrushSetDirectionL, "TestHuiGradientBrushSetDirectionL" ); |
|
76 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushSetDirectionL ); |
|
77 // Print to log file |
|
78 iLog->Log( KTestHuiGradientBrushSetDirectionL ); |
|
79 |
|
80 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
81 STIF_ASSERT_NOT_NULL( huiGradientBrush ); |
|
82 huiGradientBrush->SetDirection( CHuiGradientBrush::EDirectionUp ); |
|
83 huiGradientBrush->SetDirection( CHuiGradientBrush::EDirectionRight ); |
|
84 huiGradientBrush->SetDirection( CHuiGradientBrush::EDirectionDown ); |
|
85 huiGradientBrush->SetDirection( CHuiGradientBrush::EDirectionLeft ); |
|
86 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
87 |
|
88 return KErrNone; |
|
89 |
|
90 } |
|
91 // ----------------------------------------------------------------------------- |
|
92 // Ctestplatalfcoretoolkit::TestHuiGradientBrushSetColorL |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushSetColorL( CStifItemParser& /*aItem*/ ) |
|
96 { |
|
97 |
|
98 // Print to UI |
|
99 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
100 _LIT( KTestHuiGradientBrushSetColorL, "TestHuiGradientBrushSetColorL" ); |
|
101 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushSetColorL ); |
|
102 // Print to log file |
|
103 iLog->Log( KTestHuiGradientBrushSetColorL ); |
|
104 |
|
105 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
106 STIF_ASSERT_NOT_NULL( huiGradientBrush ); |
|
107 huiGradientBrush->SetColor( KRgbRed, .8 ); |
|
108 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
109 |
|
110 return KErrNone; |
|
111 |
|
112 } |
|
113 // ----------------------------------------------------------------------------- |
|
114 // Ctestplatalfcoretoolkit::TestHuiGradientBrushSetImageL |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushSetImageL( CStifItemParser& /*aItem*/ ) |
|
118 { |
|
119 |
|
120 // Print to UI |
|
121 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
122 _LIT( KTestHuiGradientBrushSetImageL, "TestHuiGradientBrushSetImageL" ); |
|
123 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushSetImageL ); |
|
124 // Print to log file |
|
125 iLog->Log( KTestHuiGradientBrushSetImageL ); |
|
126 |
|
127 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
128 STIF_ASSERT_NOT_NULL( huiGradientBrush ); |
|
129 const CHuiTexture* backgroundTexture = NULL; |
|
130 TInt err = iHuiEnv->Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture); |
|
131 ASSERT(backgroundTexture!=NULL); |
|
132 __ASSERT_ALWAYS( err == KErrNone, User::Invariant() ); |
|
133 |
|
134 // Apply background texture |
|
135 THuiImage background(*backgroundTexture); |
|
136 huiGradientBrush->SetImage( background ); |
|
137 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
138 |
|
139 return KErrNone; |
|
140 |
|
141 } |
|
142 // ----------------------------------------------------------------------------- |
|
143 // Ctestplatalfcoretoolkit::TestHuiGradientBrushColorL |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushColorL( CStifItemParser& /*aItem*/ ) |
|
147 { |
|
148 |
|
149 // Print to UI |
|
150 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
151 _LIT( KTestHuiGradientBrushColorL, "TestHuiGradientBrushColorL" ); |
|
152 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushColorL ); |
|
153 // Print to log file |
|
154 iLog->Log( KTestHuiGradientBrushColorL ); |
|
155 |
|
156 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
157 STIF_ASSERT_NOT_NULL( huiGradientBrush ); |
|
158 huiGradientBrush->SetColor( KRgbRed ); |
|
159 TRgb rgb = huiGradientBrush->Color( 0 ); |
|
160 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
161 |
|
162 return KErrNone; |
|
163 |
|
164 } |
|
165 // ----------------------------------------------------------------------------- |
|
166 // Ctestplatalfcoretoolkit::TestHuiGradientBrushOpacityL |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushOpacityL( CStifItemParser& /*aItem*/ ) |
|
170 { |
|
171 |
|
172 // Print to UI |
|
173 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
174 _LIT( KTestHuiGradientBrushOpacityL, "TestHuiGradientBrushOpacityL" ); |
|
175 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushOpacityL ); |
|
176 // Print to log file |
|
177 iLog->Log( KTestHuiGradientBrushOpacityL ); |
|
178 |
|
179 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
180 huiGradientBrush->SetColor( KRgbRed ); |
|
181 TReal32 real = huiGradientBrush->Opacity( .8 ); |
|
182 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
183 |
|
184 return KErrNone; |
|
185 |
|
186 } |
|
187 // ----------------------------------------------------------------------------- |
|
188 // Ctestplatalfcoretoolkit::TestHuiGradientBrushImageL |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushImageL( CStifItemParser& /*aItem*/ ) |
|
192 { |
|
193 |
|
194 // Print to UI |
|
195 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
196 _LIT( KTestHuiGradientBrushImageL, "TestHuiGradientBrushImageL" ); |
|
197 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushImageL ); |
|
198 // Print to log file |
|
199 iLog->Log( KTestHuiGradientBrushImageL ); |
|
200 |
|
201 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
202 THuiImage image = huiGradientBrush->Image(); |
|
203 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
204 |
|
205 return KErrNone; |
|
206 |
|
207 } |
|
208 // ----------------------------------------------------------------------------- |
|
209 // Ctestplatalfcoretoolkit::TestHuiGradientBrushAppendColorLL |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 TInt CTestUiAifCoreToolkit::TestHuiGradientBrushAppendColorLL( CStifItemParser& /*aItem*/ ) |
|
213 { |
|
214 |
|
215 // Print to UI |
|
216 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
217 _LIT( KTestHuiGradientBrushAppendColorLL, "TestHuiGradientBrushAppendColorLL" ); |
|
218 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiGradientBrushAppendColorLL ); |
|
219 // Print to log file |
|
220 iLog->Log( KTestHuiGradientBrushAppendColorLL ); |
|
221 |
|
222 CHuiGradientBrush* huiGradientBrush = CHuiGradientBrush::NewLC(); |
|
223 huiGradientBrush->AppendColorL( .6f, KRgbRed, 1.f ); |
|
224 CleanupStack::PopAndDestroy( huiGradientBrush ); |
|
225 |
|
226 return KErrNone; |
|
227 |
|
228 } |
|
229 |
|
230 //End of file. |