|
45
|
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 AknPopupFieldText.h
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
// [INCLUDE FILES]
|
|
|
21 |
|
|
|
22 |
#include <aknpopupfieldtext.h>
|
|
|
23 |
#include <barsread.h>
|
|
|
24 |
#include <coeaui.h>
|
|
|
25 |
#include <testsdkpopups.rsg>
|
|
|
26 |
|
|
|
27 |
#include "testsdkpopups.h"
|
|
|
28 |
|
|
|
29 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
|
30 |
// -----------------------------------------------------------------------------
|
|
|
31 |
// CTestSDKPopups::TestCPFTCAknPopupFieldTextL
|
|
|
32 |
// -----------------------------------------------------------------------------
|
|
|
33 |
//
|
|
|
34 |
TInt CTestSDKPopups::TestCPFTCAknPopupFieldTextL( CStifItemParser& /*aItem*/ )
|
|
|
35 |
{
|
|
|
36 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
37 |
CleanupStack::PushL( fieldText );
|
|
|
38 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
39 |
|
|
|
40 |
CleanupStack::PopAndDestroy( fieldText );
|
|
|
41 |
|
|
|
42 |
return KErrNone;
|
|
|
43 |
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
// -----------------------------------------------------------------------------
|
|
|
47 |
// CTestSDKPopups::TestCPFTDeconstructorL
|
|
|
48 |
// -----------------------------------------------------------------------------
|
|
|
49 |
//
|
|
|
50 |
TInt CTestSDKPopups::TestCPFTDeconstructorL( CStifItemParser& /*aItem*/ )
|
|
|
51 |
{
|
|
|
52 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
53 |
CleanupStack::PushL( fieldText );
|
|
|
54 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
55 |
|
|
|
56 |
CleanupStack::Pop( fieldText );
|
|
|
57 |
delete fieldText;
|
|
|
58 |
|
|
|
59 |
return KErrNone;
|
|
|
60 |
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
// -----------------------------------------------------------------------------
|
|
|
64 |
// CTestSDKPopups::TestCPFTCurrentValueTextLC
|
|
|
65 |
// -----------------------------------------------------------------------------
|
|
|
66 |
//
|
|
|
67 |
TInt CTestSDKPopups::TestCPFTCurrentValueTextLC( CStifItemParser& /*aItem*/ )
|
|
|
68 |
{
|
|
|
69 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
70 |
CleanupStack::PushL( fieldText );
|
|
|
71 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
72 |
|
|
|
73 |
TResourceReader reader;
|
|
|
74 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_POPUP_FIELD_TEXT );
|
|
|
75 |
fieldText->ConstructFromResourceL( reader );
|
|
|
76 |
CleanupStack::PopAndDestroy();
|
|
|
77 |
|
|
|
78 |
HBufC* text = fieldText->CurrentValueTextLC();
|
|
|
79 |
STIF_ASSERT_NOT_NULL( text );
|
|
|
80 |
|
|
|
81 |
CleanupStack::PopAndDestroy( text );
|
|
|
82 |
CleanupStack::PopAndDestroy( fieldText );
|
|
|
83 |
|
|
|
84 |
return KErrNone;
|
|
|
85 |
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
// -----------------------------------------------------------------------------
|
|
|
89 |
// CTestSDKPopups::TestCPFTCurrentValueIndexL
|
|
|
90 |
// -----------------------------------------------------------------------------
|
|
|
91 |
//
|
|
|
92 |
TInt CTestSDKPopups::TestCPFTCurrentValueIndexL( CStifItemParser& /*aItem*/ )
|
|
|
93 |
{
|
|
|
94 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
95 |
CleanupStack::PushL( fieldText );
|
|
|
96 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
97 |
|
|
|
98 |
TResourceReader reader;
|
|
|
99 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_POPUP_FIELD_TEXT );
|
|
|
100 |
fieldText->ConstructFromResourceL( reader );
|
|
|
101 |
CleanupStack::PopAndDestroy();
|
|
|
102 |
|
|
|
103 |
const TInt index = 1;
|
|
|
104 |
fieldText->SetCurrentValueIndex( index );
|
|
|
105 |
TInt indexGet = fieldText->CurrentValueIndex();
|
|
|
106 |
STIF_ASSERT_EQUALS( indexGet, index );
|
|
|
107 |
|
|
|
108 |
CleanupStack::PopAndDestroy( fieldText );
|
|
|
109 |
|
|
|
110 |
return KErrNone;
|
|
|
111 |
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
// -----------------------------------------------------------------------------
|
|
|
115 |
// CTestSDKPopups::TestCPFTSetCurrentValueIndexL
|
|
|
116 |
// -----------------------------------------------------------------------------
|
|
|
117 |
//
|
|
|
118 |
TInt CTestSDKPopups::TestCPFTSetCurrentValueIndexL( CStifItemParser& aItem )
|
|
|
119 |
{
|
|
|
120 |
return TestCPFTCurrentValueIndexL( aItem );
|
|
|
121 |
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
// -----------------------------------------------------------------------------
|
|
|
125 |
// CTestSDKPopups::TestCPFTMdcArrayL
|
|
|
126 |
// -----------------------------------------------------------------------------
|
|
|
127 |
//
|
|
|
128 |
TInt CTestSDKPopups::TestCPFTMdcArrayL( CStifItemParser& /*aItem*/ )
|
|
|
129 |
{
|
|
|
130 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
131 |
CleanupStack::PushL( fieldText );
|
|
|
132 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
133 |
|
|
|
134 |
TResourceReader reader;
|
|
|
135 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_POPUP_FIELD_TEXT );
|
|
|
136 |
fieldText->ConstructFromResourceL( reader );
|
|
|
137 |
CleanupStack::PopAndDestroy();
|
|
|
138 |
|
|
|
139 |
const TInt count = 2;
|
|
|
140 |
const MDesCArray* array = fieldText->MdcArray();
|
|
|
141 |
STIF_ASSERT_NOT_NULL( array );
|
|
|
142 |
TInt countGet = array->MdcaCount();
|
|
|
143 |
STIF_ASSERT_EQUALS( count, countGet );
|
|
|
144 |
|
|
|
145 |
CleanupStack::PopAndDestroy( fieldText );
|
|
|
146 |
|
|
|
147 |
return KErrNone;
|
|
|
148 |
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
// -----------------------------------------------------------------------------
|
|
|
152 |
// CTestSDKPopups::TestCPFTSetAutoAppendL
|
|
|
153 |
// -----------------------------------------------------------------------------
|
|
|
154 |
//
|
|
|
155 |
TInt CTestSDKPopups::TestCPFTSetAutoAppendL( CStifItemParser& /*aItem*/ )
|
|
|
156 |
{
|
|
|
157 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
158 |
CleanupStack::PushL( fieldText );
|
|
|
159 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
160 |
|
|
|
161 |
TResourceReader reader;
|
|
|
162 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_POPUP_FIELD_TEXT );
|
|
|
163 |
fieldText->ConstructFromResourceL( reader );
|
|
|
164 |
CleanupStack::PopAndDestroy();
|
|
|
165 |
|
|
|
166 |
fieldText->SetAutoAppend( EFalse );
|
|
|
167 |
fieldText->SetAutoAppend( ETrue );
|
|
|
168 |
|
|
|
169 |
CleanupStack::PopAndDestroy( fieldText );
|
|
|
170 |
|
|
|
171 |
return KErrNone;
|
|
|
172 |
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
// -----------------------------------------------------------------------------
|
|
|
176 |
// CTestSDKPopups::TestCPFTConstructFromResourceL
|
|
|
177 |
// -----------------------------------------------------------------------------
|
|
|
178 |
//
|
|
|
179 |
TInt CTestSDKPopups::TestCPFTConstructFromResourceL( CStifItemParser& /*aItem*/ )
|
|
|
180 |
{
|
|
|
181 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
182 |
CleanupStack::PushL( fieldText );
|
|
|
183 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
184 |
|
|
|
185 |
TResourceReader reader;
|
|
|
186 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_POPUP_FIELD_TEXT );
|
|
|
187 |
fieldText->ConstructFromResourceL( reader );
|
|
|
188 |
CleanupStack::PopAndDestroy();
|
|
|
189 |
|
|
|
190 |
CleanupStack::PopAndDestroy( fieldText );
|
|
|
191 |
|
|
|
192 |
return KErrNone;
|
|
|
193 |
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
// -----------------------------------------------------------------------------
|
|
|
197 |
// CTestSDKPopups::TestCPFTHandlePointerEventL
|
|
|
198 |
// -----------------------------------------------------------------------------
|
|
|
199 |
//
|
|
|
200 |
TInt CTestSDKPopups::TestCPFTHandlePointerEventL( CStifItemParser& /*aItem*/ )
|
|
|
201 |
{
|
|
|
202 |
CAknPopupFieldText* fieldText = new (ELeave) CAknPopupFieldText;
|
|
|
203 |
CleanupStack::PushL( fieldText );
|
|
|
204 |
STIF_ASSERT_NOT_NULL( fieldText );
|
|
|
205 |
|
|
|
206 |
TResourceReader reader;
|
|
|
207 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_POPUP_FIELD_TEXT );
|
|
|
208 |
fieldText->ConstructFromResourceL( reader );
|
|
|
209 |
CleanupStack::PopAndDestroy();
|
|
|
210 |
|
|
|
211 |
TPointerEvent event;
|
|
|
212 |
event.iType = TPointerEvent::EButton1Down;
|
|
|
213 |
event.iModifiers = 0;
|
|
|
214 |
TPoint eventPos( 10, 30 );
|
|
|
215 |
event.iPosition = eventPos;
|
|
|
216 |
event.iParentPosition = eventPos;
|
|
|
217 |
|
|
|
218 |
fieldText->HandlePointerEventL( event );
|
|
|
219 |
|
|
|
220 |
CleanupStack::PopAndDestroy( fieldText );
|
|
|
221 |
|
|
|
222 |
return KErrNone;
|
|
|
223 |
|
|
|
224 |
}
|