|
1 /* |
|
2 * Copyright (c) 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: Unit tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __UT_CGLXNAVIGABLELIST_H__ |
|
22 #define __UT_CGLXNAVIGABLELIST_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/ceunittestsuiteclass.h> |
|
26 #include <digia/eunit/eunitdecorators.h> |
|
27 |
|
28 // INTERNAL INCLUDES |
|
29 #include "glxnavigablelist.h" |
|
30 #include "glxlistreconstruction.h" |
|
31 #include "glxlisttestbase.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 |
|
35 /** |
|
36 * Reconstruction of a navigable item list |
|
37 */ |
|
38 NONSHARABLE_CLASS( CGlxNavigableListReconstruction ) : public CGlxListReconstruction< CGlxNavigableList > |
|
39 { |
|
40 public: |
|
41 static CGlxNavigableListReconstruction* NewL( TInt aReservationCount = 400 ); |
|
42 // From CGlxListReconstructionBase |
|
43 TBool ReconstructionEquals() const; |
|
44 |
|
45 private: |
|
46 TBool SelectionEquals() const; |
|
47 TInt FindInOriginalSelection( TInt aSelectionIndex ) const; |
|
48 }; |
|
49 |
|
50 /** |
|
51 * EUnit test suite |
|
52 */ |
|
53 NONSHARABLE_CLASS( ut_CGlxNavigableList ) : |
|
54 public CGlxListTestBase< CGlxNavigableList, CGlxNavigableListReconstruction > |
|
55 { |
|
56 public: // Constructors and destructors |
|
57 /** |
|
58 * Two phase construction |
|
59 */ |
|
60 static ut_CGlxNavigableList* NewL(); |
|
61 static ut_CGlxNavigableList* NewLC(); |
|
62 /** |
|
63 * Destructor |
|
64 */ |
|
65 ~ut_CGlxNavigableList(); |
|
66 |
|
67 private: // Constructors and destructors |
|
68 ut_CGlxNavigableList(); |
|
69 void ConstructL(); |
|
70 |
|
71 private: // New methods |
|
72 void SetupL(); |
|
73 void Teardown(); |
|
74 |
|
75 void T_SetContentsLL(); |
|
76 void T_ReorderContentsLL(); |
|
77 void T_RemoveL(); |
|
78 void T_RemoveReferenceL(); |
|
79 void T_AddStaticItemLL(); |
|
80 void T_SetStaticItemsEnabledL(); |
|
81 void T_CountL(); |
|
82 void T_FocusIndexL(); |
|
83 void T_SetFocusL(); |
|
84 void T_ItemL(); |
|
85 void T_IndexL(); |
|
86 void T_IsSelectedL(); |
|
87 void T_SetSelectedLL(); |
|
88 void T_SelectedItemIndicesL(); |
|
89 void T_IdSpaceIdL(); |
|
90 |
|
91 TBool TrySetFocusL( const TDesC8& aContents, TInt aInitialFocus, |
|
92 NGlxListDefs::TFocusSetType aFocusSetType, TInt aFocusValue, TInt aExpectedFocus, |
|
93 const TNotification::TData* aNotificationList ); |
|
94 |
|
95 TBool TrySetContentsL( const TDesC8& aStringBefore, |
|
96 const TDesC8& aStringAfter, TBool aFocusBefore, TBool aFocusAfter, |
|
97 const TDesC8& aSelectionBefore, const TDesC8& aSelectionAfter, |
|
98 const TNotification::TData* aNotificationList ); |
|
99 |
|
100 TBool TryReorderContentsL( const TDesC8& aStringBefore, |
|
101 const TDesC8& aStringAfter, TBool aFocusBefore, TBool aFocusAfter, |
|
102 const TDesC8& aSelectionBefore, const TDesC8& aSelectionAfter, |
|
103 const TNotification::TData* aNotificationList ); |
|
104 |
|
105 TBool TrySetSelectedL( const TDesC8& aContents, |
|
106 const TDesC8& aInitialSelection, const TDesC8& aFinalSelection, |
|
107 TBool aSelect, TInt aIndex, const TNotification::TData* aNotificationList ); |
|
108 |
|
109 void SetSelectedL( const TDesC8& aSelection ); |
|
110 TBool SelectionEquals( const TDesC8& aSelection ) const; |
|
111 |
|
112 private: // Data |
|
113 |
|
114 EUNIT_DECLARE_TEST_TABLE; |
|
115 |
|
116 }; |
|
117 |
|
118 #endif // __UT_CGLXNAVIGABLELIST_H__ |