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/huiFrameBrush.h> |
|
20 |
|
21 #include "testuiaifcoretoolkit.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // Ctestplatalfcoretoolkit::TestHuiFrameBrushNewLL |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 TInt CTestUiAifCoreToolkit::TestHuiFrameBrushNewLL( CStifItemParser& /*aItem*/ ) |
|
28 { |
|
29 |
|
30 // Print to UI |
|
31 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
32 _LIT( KTestHuiFrameBrushNewLL, "TestHuiFrameBrushNewLL" ); |
|
33 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiFrameBrushNewLL ); |
|
34 // Print to log file |
|
35 iLog->Log( KTestHuiFrameBrushNewLL ); |
|
36 |
|
37 TAknsItemID id; |
|
38 id.Set( TUid::Uid( 0 ), 0 ); |
|
39 CHuiFrameBrush* huiFrameBrush = CHuiFrameBrush::NewL( id, 0, 0 ); |
|
40 CleanupStack::PushL( huiFrameBrush ); |
|
41 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
42 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
43 |
|
44 THuiMetric metric( 0 ); |
|
45 THuiXYMetric offset( metric ); |
|
46 huiFrameBrush = CHuiFrameBrush::NewL( id, offset ); |
|
47 CleanupStack::PushL( huiFrameBrush ); |
|
48 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
49 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
50 |
|
51 // THuiImage image; |
|
52 const CHuiTexture* backgroundTexture = NULL; |
|
53 TInt err = iHuiEnv->Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture); |
|
54 ASSERT(backgroundTexture!=NULL); |
|
55 __ASSERT_ALWAYS( err == KErrNone, User::Invariant() ); |
|
56 |
|
57 // Apply background texture |
|
58 THuiImage background(*backgroundTexture); |
|
59 huiFrameBrush = CHuiFrameBrush::NewL( background, offset ); |
|
60 CleanupStack::PushL( huiFrameBrush ); |
|
61 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
62 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
63 |
|
64 return KErrNone; |
|
65 |
|
66 } |
|
67 // ----------------------------------------------------------------------------- |
|
68 // Ctestplatalfcoretoolkit::TestHuiFrameBrushNewLCL |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 TInt CTestUiAifCoreToolkit::TestHuiFrameBrushNewLCL( CStifItemParser& /*aItem*/ ) |
|
72 { |
|
73 |
|
74 // Print to UI |
|
75 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
76 _LIT( KTestHuiFrameBrushNewLCL, "TestHuiFrameBrushNewLCL" ); |
|
77 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiFrameBrushNewLCL ); |
|
78 // Print to log file |
|
79 iLog->Log( KTestHuiFrameBrushNewLCL ); |
|
80 |
|
81 TAknsItemID id; |
|
82 id.Set( TUid::Uid( 0 ), 0 ); |
|
83 CHuiFrameBrush* huiFrameBrush = CHuiFrameBrush::NewLC( id,-2,-1); |
|
84 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
85 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
86 |
|
87 THuiMetric metric( 0 ); |
|
88 THuiXYMetric offset( metric ); |
|
89 huiFrameBrush = CHuiFrameBrush::NewLC( id, offset ); |
|
90 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
91 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
92 |
|
93 const CHuiTexture* backgroundTexture = NULL; |
|
94 TInt err = iHuiEnv->Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture); |
|
95 ASSERT(backgroundTexture!=NULL); |
|
96 __ASSERT_ALWAYS( err == KErrNone, User::Invariant() ); |
|
97 |
|
98 // Apply background texture |
|
99 THuiImage background(*backgroundTexture); |
|
100 huiFrameBrush = CHuiFrameBrush::NewLC( background, offset ); |
|
101 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
102 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
103 |
|
104 return KErrNone; |
|
105 |
|
106 } |
|
107 // ----------------------------------------------------------------------------- |
|
108 // Ctestplatalfcoretoolkit::TestHuiFrameBrushSetFrameRectsLL |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 TInt CTestUiAifCoreToolkit::TestHuiFrameBrushSetFrameRectsLL( CStifItemParser& /*aItem*/ ) |
|
112 { |
|
113 |
|
114 // Print to UI |
|
115 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
116 _LIT( KTestHuiFrameBrushSetFrameRectsLL, "TestHuiFrameBrushSetFrameRectsLL" ); |
|
117 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiFrameBrushSetFrameRectsLL ); |
|
118 // Print to log file |
|
119 iLog->Log( KTestHuiFrameBrushSetFrameRectsLL ); |
|
120 |
|
121 TAknsItemID id; |
|
122 id.Set( TUid::Uid( 0 ), 0 ); |
|
123 CHuiFrameBrush* huiFrameBrush = CHuiFrameBrush::NewLC( id,-2,-1); |
|
124 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
125 TRect outerrect(0,0,100,100); |
|
126 TRect innerrect(10,10,90,90); |
|
127 // CHuiTexture& texture = iHuiEnv->TextureManager().BlankTexture(); |
|
128 // THuiImage image( texture ); |
|
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 huiFrameBrush->SetImage( background ); |
|
137 huiFrameBrush->SetFrameRectsL( innerrect, outerrect ); |
|
138 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
139 |
|
140 return KErrNone; |
|
141 |
|
142 } |
|
143 // ----------------------------------------------------------------------------- |
|
144 // Ctestplatalfcoretoolkit::TestHuiFrameBrushSetEdgeOffsetL |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 TInt CTestUiAifCoreToolkit::TestHuiFrameBrushSetEdgeOffsetL( CStifItemParser& /*aItem*/ ) |
|
148 { |
|
149 |
|
150 // Print to UI |
|
151 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
152 _LIT( KTestHuiFrameBrushSetEdgeOffsetL, "TestHuiFrameBrushSetEdgeOffsetL" ); |
|
153 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiFrameBrushSetEdgeOffsetL ); |
|
154 // Print to log file |
|
155 iLog->Log( KTestHuiFrameBrushSetEdgeOffsetL ); |
|
156 |
|
157 TAknsItemID id; |
|
158 id.Set( TUid::Uid( 0 ), 0 ); |
|
159 CHuiFrameBrush* huiFrameBrush = CHuiFrameBrush::NewLC( id,-2,-1); |
|
160 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
161 THuiMetric metric( 0 ); |
|
162 THuiXYMetric offset( metric ); |
|
163 huiFrameBrush->SetEdgeOffset( offset ); |
|
164 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
165 |
|
166 return KErrNone; |
|
167 |
|
168 } |
|
169 // ----------------------------------------------------------------------------- |
|
170 // Ctestplatalfcoretoolkit::TestHuiFrameBrushSetImageL |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 TInt CTestUiAifCoreToolkit::TestHuiFrameBrushSetImageL( CStifItemParser& /*aItem*/ ) |
|
174 { |
|
175 |
|
176 // Print to UI |
|
177 _LIT( Ktestplatalfcoretoolkit, "testplatalfcoretoolkit" ); |
|
178 _LIT( KTestHuiFrameBrushSetImageL, "TestHuiFrameBrushSetImageL" ); |
|
179 TestModuleIf().Printf( 0, Ktestplatalfcoretoolkit, KTestHuiFrameBrushSetImageL ); |
|
180 // Print to log file |
|
181 iLog->Log( KTestHuiFrameBrushSetImageL ); |
|
182 |
|
183 TAknsItemID id; |
|
184 id.Set( TUid::Uid( 0 ), 0 ); |
|
185 CHuiFrameBrush* huiFrameBrush = CHuiFrameBrush::NewLC( id,-2,-1); |
|
186 STIF_ASSERT_NOT_NULL( huiFrameBrush ); |
|
187 THuiMetric metric( 0 ); |
|
188 THuiXYMetric offset( metric ); |
|
189 // THuiImage image; |
|
190 const CHuiTexture* backgroundTexture = NULL; |
|
191 TInt err = iHuiEnv->Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture); |
|
192 ASSERT(backgroundTexture!=NULL); |
|
193 __ASSERT_ALWAYS( err == KErrNone, User::Invariant() ); |
|
194 |
|
195 // Apply background texture |
|
196 THuiImage background(*backgroundTexture); |
|
197 huiFrameBrush->SetImage( background ); |
|
198 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartCornerTl, background ); |
|
199 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartCenter, background ); |
|
200 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartCornerTr, background ); |
|
201 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartCornerBl, background ); |
|
202 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartCornerBr, background ); |
|
203 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartSideB, background ); |
|
204 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartSideL, background ); |
|
205 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartSideR, background ); |
|
206 huiFrameBrush->SetImage( CHuiFrameBrush::EFramePartSideT, background ); |
|
207 CleanupStack::PopAndDestroy( huiFrameBrush ); |
|
208 |
|
209 return KErrNone; |
|
210 |
|
211 } |
|
212 |
|
213 //End of file. |
|