|
56
|
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 eikfnlab.h
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
// [INCLUDE FILES]
|
|
|
21 |
|
|
|
22 |
#include <eikfnlab.h>
|
|
|
23 |
#include <AknsConstants.h>
|
|
|
24 |
#include <akndef.h>
|
|
|
25 |
#include <coeaui.h>
|
|
|
26 |
|
|
|
27 |
#include "testsdklabels.h"
|
|
|
28 |
#include "testsdklabelsview.h"
|
|
|
29 |
#include "testsdklabelscontainer.h"
|
|
|
30 |
|
|
|
31 |
class CTestSDKEikFileNameLabel : public CEikFileNameLabel
|
|
|
32 |
{
|
|
|
33 |
friend class CTestSDKLabels;
|
|
|
34 |
|
|
|
35 |
public:
|
|
|
36 |
CTestSDKEikFileNameLabel(){}
|
|
|
37 |
|
|
|
38 |
};
|
|
|
39 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
|
40 |
|
|
|
41 |
// -----------------------------------------------------------------------------
|
|
|
42 |
// CTestSDKLabels::TestLCEikFileNameLabelL
|
|
|
43 |
// -----------------------------------------------------------------------------
|
|
|
44 |
//
|
|
|
45 |
TInt CTestSDKLabels::TestLCEikFileNameLabelL( CStifItemParser& /*aItem*/ )
|
|
|
46 |
{
|
|
|
47 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
48 |
CleanupStack::PushL( fileNameLabel );
|
|
|
49 |
|
|
|
50 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
51 |
fileNameLabel->ConstructL();
|
|
|
52 |
|
|
|
53 |
CleanupStack::PopAndDestroy( fileNameLabel );
|
|
|
54 |
|
|
|
55 |
return KErrNone;
|
|
|
56 |
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
// -----------------------------------------------------------------------------
|
|
|
60 |
// CTestSDKLabels::TestLDeconstructorL
|
|
|
61 |
// -----------------------------------------------------------------------------
|
|
|
62 |
//
|
|
|
63 |
TInt CTestSDKLabels::TestLDeconstructorL( CStifItemParser& /*aItem*/ )
|
|
|
64 |
{
|
|
|
65 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
66 |
CleanupStack::PushL( fileNameLabel );
|
|
|
67 |
|
|
|
68 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
69 |
fileNameLabel->ConstructL();
|
|
|
70 |
|
|
|
71 |
CleanupStack::Pop( fileNameLabel );
|
|
|
72 |
delete fileNameLabel;
|
|
|
73 |
|
|
|
74 |
return KErrNone;
|
|
|
75 |
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
// -----------------------------------------------------------------------------
|
|
|
79 |
// CTestSDKLabels::TestLConstructL
|
|
|
80 |
// -----------------------------------------------------------------------------
|
|
|
81 |
//
|
|
|
82 |
TInt CTestSDKLabels::TestLConstructL( CStifItemParser& /*aItem*/ )
|
|
|
83 |
{
|
|
|
84 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
85 |
CleanupStack::PushL( fileNameLabel );
|
|
|
86 |
|
|
|
87 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
88 |
fileNameLabel->ConstructL();
|
|
|
89 |
|
|
|
90 |
CleanupStack::PopAndDestroy( fileNameLabel );
|
|
|
91 |
|
|
|
92 |
return KErrNone;
|
|
|
93 |
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
// -----------------------------------------------------------------------------
|
|
|
97 |
// CTestSDKLabels::TestLUpdateL
|
|
|
98 |
// -----------------------------------------------------------------------------
|
|
|
99 |
//
|
|
|
100 |
TInt CTestSDKLabels::TestLUpdateL( CStifItemParser& /*aItem*/ )
|
|
|
101 |
{
|
|
|
102 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
103 |
CleanupStack::PushL( fileNameLabel );
|
|
|
104 |
|
|
|
105 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
106 |
fileNameLabel->ConstructL();
|
|
|
107 |
|
|
|
108 |
STIF_ASSERT_NOT_LEAVES( fileNameLabel->UpdateL() );
|
|
|
109 |
|
|
|
110 |
CleanupStack::PopAndDestroy( fileNameLabel );
|
|
|
111 |
|
|
|
112 |
return KErrNone;
|
|
|
113 |
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
// -----------------------------------------------------------------------------
|
|
|
117 |
// CTestSDKLabels::TestLGetColorUseListL
|
|
|
118 |
// -----------------------------------------------------------------------------
|
|
|
119 |
//
|
|
|
120 |
TInt CTestSDKLabels::TestLGetColorUseListL( CStifItemParser& /*aItem*/ )
|
|
|
121 |
{
|
|
|
122 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
123 |
CleanupStack::PushL( fileNameLabel );
|
|
|
124 |
|
|
|
125 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
126 |
fileNameLabel->ConstructL();
|
|
|
127 |
|
|
|
128 |
CArrayFix<TCoeColorUse>* colorUseList = new (ELeave) CArrayFixFlat<TCoeColorUse>( 1 );
|
|
|
129 |
CleanupStack::PushL( colorUseList );
|
|
|
130 |
STIF_ASSERT_NOT_LEAVES( fileNameLabel->GetColorUseListL( *colorUseList ) );
|
|
|
131 |
STIF_ASSERT_NOT_NULL( colorUseList );
|
|
|
132 |
|
|
|
133 |
CleanupStack::PopAndDestroy( colorUseList );
|
|
|
134 |
CleanupStack::PopAndDestroy( fileNameLabel );
|
|
|
135 |
|
|
|
136 |
return KErrNone;
|
|
|
137 |
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
// -----------------------------------------------------------------------------
|
|
|
141 |
// CTestSDKLabels::TestLHandleResourceChangeL
|
|
|
142 |
// -----------------------------------------------------------------------------
|
|
|
143 |
//
|
|
|
144 |
TInt CTestSDKLabels::TestLHandleResourceChangeL( CStifItemParser& /*aItem*/ )
|
|
|
145 |
{
|
|
|
146 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
147 |
CleanupStack::PushL( fileNameLabel );
|
|
|
148 |
|
|
|
149 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
150 |
fileNameLabel->ConstructL();
|
|
|
151 |
|
|
|
152 |
fileNameLabel->HandleResourceChange( KAknsMessageSkinChange );
|
|
|
153 |
fileNameLabel->HandleResourceChange( KEikDynamicLayoutVariantSwitch );
|
|
|
154 |
|
|
|
155 |
CleanupStack::PopAndDestroy( fileNameLabel );
|
|
|
156 |
|
|
|
157 |
return KErrNone;
|
|
|
158 |
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
// -----------------------------------------------------------------------------
|
|
|
162 |
// CTestSDKLabels::TestLMinimumSizeL
|
|
|
163 |
// -----------------------------------------------------------------------------
|
|
|
164 |
//
|
|
|
165 |
TInt CTestSDKLabels::TestLMinimumSizeL( CStifItemParser& /*aItem*/ )
|
|
|
166 |
{
|
|
|
167 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
168 |
CleanupStack::PushL( fileNameLabel );
|
|
|
169 |
|
|
|
170 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
171 |
fileNameLabel->ConstructL();
|
|
|
172 |
|
|
|
173 |
TSize minsize = fileNameLabel->MinimumSize();
|
|
|
174 |
TPoint point( minsize.AsPoint() );
|
|
|
175 |
|
|
|
176 |
STIF_ASSERT_NOT_EQUALS( 0, point.iX );
|
|
|
177 |
STIF_ASSERT_NOT_EQUALS( 0, point.iY );
|
|
|
178 |
|
|
|
179 |
CleanupStack::PopAndDestroy( fileNameLabel );
|
|
|
180 |
|
|
|
181 |
return KErrNone;
|
|
|
182 |
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
// -----------------------------------------------------------------------------
|
|
|
186 |
// CTestSDKLabels::TestLHandlePointerEventL
|
|
|
187 |
// -----------------------------------------------------------------------------
|
|
|
188 |
//
|
|
|
189 |
TInt CTestSDKLabels::TestLHandlePointerEventL( CStifItemParser& /*aItem*/ )
|
|
|
190 |
{
|
|
|
191 |
CEikFileNameLabel* fileNameLabel = new (ELeave) CEikFileNameLabel;
|
|
|
192 |
CleanupStack::PushL( fileNameLabel );
|
|
|
193 |
|
|
|
194 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
195 |
fileNameLabel->ConstructL();
|
|
|
196 |
|
|
|
197 |
TPointerEvent event;
|
|
|
198 |
event.iModifiers = 0;
|
|
|
199 |
TPoint eventPos( 10, 30 );
|
|
|
200 |
event.iPosition = eventPos;
|
|
|
201 |
event.iParentPosition = eventPos;
|
|
|
202 |
event.iType = TPointerEvent::EButton1Down;
|
|
|
203 |
fileNameLabel->HandlePointerEventL( event );
|
|
|
204 |
|
|
|
205 |
event.iType = TPointerEvent::EButton2Down;
|
|
|
206 |
fileNameLabel->HandlePointerEventL( event );
|
|
|
207 |
|
|
|
208 |
CleanupStack::PopAndDestroy( fileNameLabel );
|
|
|
209 |
|
|
|
210 |
return KErrNone;
|
|
|
211 |
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
// -----------------------------------------------------------------------------
|
|
|
215 |
// CTestSDKLabels::TestLDrawL
|
|
|
216 |
// -----------------------------------------------------------------------------
|
|
|
217 |
//
|
|
|
218 |
TInt CTestSDKLabels::TestLDrawL( CStifItemParser& /*aItem*/ )
|
|
|
219 |
{
|
|
|
220 |
CTestSDKLabelsView* view = CTestSDKLabelsView::NewL();
|
|
|
221 |
CleanupStack::PushL( view );
|
|
|
222 |
CTestSDKLabelsContainer* container = new ( ELeave ) CTestSDKLabelsContainer;
|
|
|
223 |
CleanupStack::PushL( container );
|
|
|
224 |
|
|
|
225 |
container->SetMopParent( view );
|
|
|
226 |
container->ConstructL( view->ClientRect() );
|
|
|
227 |
CCoeEnv::Static()->AppUi()->AddToStackL( container );
|
|
|
228 |
container->MakeVisible( ETrue );
|
|
|
229 |
|
|
|
230 |
CTestSDKEikFileNameLabel* fileNameLabel = new (ELeave) CTestSDKEikFileNameLabel;
|
|
|
231 |
CleanupStack::PushL( fileNameLabel );
|
|
|
232 |
STIF_ASSERT_NOT_NULL( fileNameLabel );
|
|
|
233 |
fileNameLabel->ConstructL();
|
|
|
234 |
|
|
|
235 |
container->SetControlL( fileNameLabel );
|
|
|
236 |
|
|
|
237 |
container->ActivateGc();
|
|
|
238 |
TRect rect( 1, 1, 1, 1 );
|
|
|
239 |
fileNameLabel->Draw( rect );
|
|
|
240 |
container->DeactivateGc();
|
|
|
241 |
|
|
|
242 |
CleanupStack::Pop( fileNameLabel );
|
|
|
243 |
CCoeEnv::Static()->AppUi()->RemoveFromStack( container );
|
|
|
244 |
CleanupStack::PopAndDestroy( 2 );
|
|
|
245 |
|
|
|
246 |
return KErrNone;
|
|
|
247 |
|
|
|
248 |
}
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
// [End of File]
|