|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent - Internal Symbian test code |
|
19 */ |
|
20 |
|
21 |
|
22 #if !defined(__TCONE6STEP_H__) |
|
23 #define __TCONE6STEP_H__ |
|
24 |
|
25 #include <test/testexecutestepbase.h> |
|
26 #include "TConeTestServer.h" |
|
27 #include "appfwk_test_AppUi.h" |
|
28 #include <coecntrl.h> |
|
29 |
|
30 //! A CCoeControl derived Class.\n |
|
31 /** |
|
32 Base class used to derive CCtlContainer and CCtlContainee classes.\n |
|
33 */ |
|
34 class CCtlBase : public CCoeControl |
|
35 { |
|
36 public: |
|
37 ~CCtlBase(); |
|
38 protected: |
|
39 CCtlBase(); |
|
40 void WriteName( CWindowGc& aGc, const TDesC& aText ) const ; |
|
41 void ConstructL() ; |
|
42 void DoDraw( CWindowGc& aGc, TRect aRect ) const ; |
|
43 protected: |
|
44 HBufC* iName; |
|
45 private: |
|
46 CFont* iFont; |
|
47 }; |
|
48 |
|
49 //! A CTestStep Derived Class.\n |
|
50 /** |
|
51 Incorporates the tests on component-container control interface.\n |
|
52 */ |
|
53 class CTCone6Step : public CTmsTestStep |
|
54 { |
|
55 public: |
|
56 CTCone6Step(); |
|
57 ~CTCone6Step(); |
|
58 virtual TVerdict doTestStepL(); |
|
59 void ConstructAppL(CCoeEnv* aCoe); |
|
60 }; |
|
61 |
|
62 //! A CCtlBase Derived Class.\n |
|
63 /** |
|
64 Implements the containee class.\n |
|
65 */ |
|
66 class CCtlContainee : public CCtlBase |
|
67 { |
|
68 public: |
|
69 CCtlContainee() ; |
|
70 ~CCtlContainee() ; |
|
71 void ConstructL( const TDesC& aName ) ; |
|
72 const TDesC& WhoAmI() const ; |
|
73 private: |
|
74 void Draw(const TRect& aRect) const ; |
|
75 |
|
76 }; |
|
77 |
|
78 //! A CCtlContainee Derived Class.\n |
|
79 /** |
|
80 Implements the containee class but cannot get any parent.\n |
|
81 */ |
|
82 class CCtlUnparentableContainee : public CCtlContainee |
|
83 { |
|
84 public: //from CCtlContainee |
|
85 TInt SetParent(CCoeControl* /*aParent*/) { return KErrNotSupported; } |
|
86 }; |
|
87 |
|
88 //! A CCtlBase Derived Class.\n |
|
89 /** |
|
90 Implements the container class.\n |
|
91 */ |
|
92 class CCtlContainer : public CCtlBase |
|
93 { |
|
94 public: |
|
95 CCtlContainer(); |
|
96 ~CCtlContainer(); |
|
97 void ConstructL(const TDesC& aName); |
|
98 TBool TestRemoveControlById(); |
|
99 TBool TestCleanupL(); |
|
100 TBool TestGetControlL(); |
|
101 TBool TestGetControlConstL() const; |
|
102 TBool TestGetUnknownControlConstL() const ; |
|
103 TBool TestAddDuplicateControlL() ; |
|
104 TBool TestRemoveNonExistantById() ; |
|
105 TBool TestRemoveControlL() ; |
|
106 TBool TestGetUnsetUniqueHandle() ; |
|
107 TBool TestSetUniqueHandle() ; |
|
108 TBool TestGetUniqueHandle() ; |
|
109 TBool TestSetUniqueHandleOOM() ; |
|
110 TBool TestInsertAfter(); |
|
111 TBool TestInsertLast(); |
|
112 TBool TestFailingInsertAfter(); |
|
113 TBool TestId(); |
|
114 TBool TestCursor(); |
|
115 TBool TestFind(); |
|
116 TBool TestRemove(); |
|
117 TBool TestReplace(); |
|
118 TBool TestSetArrayLocked(); |
|
119 TBool TestSort(); |
|
120 TBool TestOwnedExternally(); |
|
121 void TestHandleDestructionOfFocusedItemL(); |
|
122 static TInt CompareControls(const TCoeControlWithId& aFirst, const TCoeControlWithId& aSecond); |
|
123 private: |
|
124 virtual void SizeChanged() ; |
|
125 void Draw(const TRect& aRect) const ; |
|
126 private: |
|
127 CCtlContainee* iOrphan; |
|
128 //! Child Control Identifiers.\n |
|
129 enum |
|
130 { |
|
131 KChildOneID, |
|
132 KChildTwoID, |
|
133 KChildThreeID, |
|
134 KChildFourID, |
|
135 KChildFiveID, |
|
136 KChildSixID |
|
137 }; |
|
138 }; |
|
139 |
|
140 // A MCoeFocusObserver derived class.\n |
|
141 |
|
142 /** |
|
143 Implements MCoeFocusObserver derived class.\n |
|
144 */ |
|
145 class CTestMCoeFocusObserver : public CBase, public MCoeFocusObserver |
|
146 { |
|
147 public: |
|
148 ~CTestMCoeFocusObserver(); |
|
149 CTestMCoeFocusObserver(CCoeControl& aContainer); |
|
150 //from MCoeFocusObserver |
|
151 void HandleDestructionOfFocusedItem(); |
|
152 void HandleChangeInFocus(); |
|
153 private: |
|
154 CCoeControl& iCtlContainer; |
|
155 }; |
|
156 |
|
157 // A CCoecontrol derived class.\n |
|
158 |
|
159 /** |
|
160 Implements CCoeControl derived class.\n |
|
161 */ |
|
162 class CParentControl : public CCoeControl |
|
163 { |
|
164 public: |
|
165 CCoeControlArray& Components() { return CCoeControl::Components(); } |
|
166 void InitComponentArrayL() { CCoeControl::InitComponentArrayL(); } |
|
167 }; |
|
168 |
|
169 //! A CTestCoeAppUi derived class.\n |
|
170 /** |
|
171 AppUi Class for TCone6Step.\n |
|
172 */ |
|
173 class CCone6TestAppUi : public CTestCoeAppUi |
|
174 { |
|
175 public: |
|
176 CCone6TestAppUi(CTmsTestStep* aStep); |
|
177 ~CCone6TestAppUi(); |
|
178 void ConstructL(); |
|
179 private: // from CCoeAppUi |
|
180 TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
181 private: // utility |
|
182 void RunTestStepL(TInt aStepNum); |
|
183 void ReinitializeContainerL(); |
|
184 //! Pointer to the container control.\n |
|
185 CCtlContainer* iContainer ; |
|
186 }; |
|
187 |
|
188 //! TCone6 Test Step Name.\n |
|
189 _LIT(KTCone6Step,"TCone6"); |
|
190 |
|
191 #endif |
|
192 |
|
193 |