|
1 /* |
|
2 * Copyright (c) 2008 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 eikscbut.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // [INCLUDE FILES] |
|
20 #include <eikscbut.h> |
|
21 |
|
22 #include "testsdkscroller.h" |
|
23 #include "testsdkscrollercontrol.h" |
|
24 |
|
25 // CONSTANTS |
|
26 const TInt KPointX = 5; |
|
27 const TInt KPointY = 5; |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CTestSDKScroller::TestSDKEikScbDefConsWithPaL |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 TInt CTestSDKScroller::TestSDKEikScbDefConsWithPaL( CStifItemParser& /*aItem*/ ) |
|
36 { |
|
37 |
|
38 // Print to UI |
|
39 _LIT( KTestSDKScroller, "testsdkscroller" ); |
|
40 _LIT( KTestSDKEikScbDefConsWithPa, "in EikScbDefConsWithPa" ); |
|
41 TestModuleIf().Printf( 0, KTestSDKScroller, KTestSDKEikScbDefConsWithPa ); |
|
42 // Print to log file |
|
43 iLog->Log( KTestSDKEikScbDefConsWithPa ); |
|
44 |
|
45 CEikScrollButton::TType type = CEikScrollButton::ENudgeLeft; |
|
46 CEikScrollButton* scButton = new ( ELeave ) CEikScrollButton( type ); |
|
47 CleanupStack::PushL( scButton ); |
|
48 STIF_ASSERT_NOT_NULL( scButton ); |
|
49 |
|
50 CleanupStack::PopAndDestroy( scButton ); |
|
51 return KErrNone; |
|
52 |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CTestSDKScroller::TestSDKEikScbTypeL |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 TInt CTestSDKScroller::TestSDKEikScbTypeL( CStifItemParser& /*aItem*/ ) |
|
60 { |
|
61 |
|
62 // Print to UI |
|
63 _LIT( KTestSDKScroller, "testsdkscroller" ); |
|
64 _LIT( KTestSDKEikScbType, "in EikScbType" ); |
|
65 TestModuleIf().Printf( 0, KTestSDKScroller, KTestSDKEikScbType ); |
|
66 // Print to log file |
|
67 iLog->Log( KTestSDKEikScbType ); |
|
68 |
|
69 CEikScrollButton::TType type = CEikScrollButton::ENudgeUp; |
|
70 CEikScrollButton* scButton = new ( ELeave ) CEikScrollButton( type ); |
|
71 CleanupStack::PushL( scButton ); |
|
72 |
|
73 CEikScrollButton::TType sbType = scButton->Type(); |
|
74 STIF_ASSERT_EQUALS( type, sbType ); |
|
75 |
|
76 CleanupStack::PopAndDestroy( scButton ); |
|
77 return KErrNone; |
|
78 |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CTestSDKScroller::TestSDKEikScbHanPoiEveL |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 TInt CTestSDKScroller::TestSDKEikScbHanPoiEveL( CStifItemParser& /*aItem*/ ) |
|
86 { |
|
87 |
|
88 // Print to UI |
|
89 _LIT( KTestSDKScroller, "testsdkscroller" ); |
|
90 _LIT( KTestSDKEikScbHanPoiEveL, "in EikScbHanPoiEveL" ); |
|
91 TestModuleIf().Printf( 0, KTestSDKScroller, KTestSDKEikScbHanPoiEveL ); |
|
92 // Print to log file |
|
93 iLog->Log( KTestSDKEikScbHanPoiEveL ); |
|
94 |
|
95 CEikScrollButton::TType type = CEikScrollButton::ENudgeUp; |
|
96 CEikScrollButton* scButton = new ( ELeave ) CEikScrollButton( type ); |
|
97 CleanupStack::PushL( scButton ); |
|
98 |
|
99 TPointerEvent event; |
|
100 event.iType = TPointerEvent::EButton1Down; |
|
101 event.iModifiers = 0; |
|
102 TPoint eventPos( KPointX, KPointY ); |
|
103 event.iPosition = eventPos; |
|
104 event.iParentPosition = eventPos; |
|
105 |
|
106 scButton->HandlePointerEventL( event ); |
|
107 |
|
108 CleanupStack::PopAndDestroy( scButton ); |
|
109 return KErrNone; |
|
110 |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CTestSDKScroller::TestSDKEikAhSbNewL |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 TInt CTestSDKScroller::TestSDKEikAhSbNewL( CStifItemParser& /*aItem*/ ) |
|
118 { |
|
119 |
|
120 // Print to UI |
|
121 _LIT( KTestSDKScroller, "testsdkscroller" ); |
|
122 _LIT( KTestSDKEikAhSbNewL, "in EikAhSbNewL" ); |
|
123 TestModuleIf().Printf( 0, KTestSDKScroller, KTestSDKEikAhSbNewL ); |
|
124 // Print to log file |
|
125 iLog->Log( KTestSDKEikAhSbNewL ); |
|
126 |
|
127 CTestScrollerControl* control = CTestScrollerControl::NewL(); |
|
128 CleanupStack::PushL( control ); |
|
129 CEikScrollButton::TType type = CEikScrollButton::ENudgeUp; |
|
130 |
|
131 CEikArrowHeadScrollButton* ahScBut = CEikArrowHeadScrollButton::NewL( control, type ); |
|
132 CleanupStack::PushL( ahScBut ); |
|
133 STIF_ASSERT_NULL( ahScBut ); |
|
134 |
|
135 CleanupStack::PopAndDestroy( ahScBut ); |
|
136 CleanupStack::PopAndDestroy( control ); |
|
137 return KErrNone; |
|
138 |
|
139 } |
|
140 |