|
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: CGlxAttributeContext unit tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __UT_CGLXATTRIBUTECONTEXT_H__ |
|
22 #define __UT_CGLXATTRIBUTECONTEXT_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/ceunittestsuiteclass.h> |
|
26 |
|
27 // INTERNAL INCLUDES |
|
28 #include "mglxmedialist.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CGlxDefaultAttributeContext; |
|
32 |
|
33 #include <e32def.h> |
|
34 #ifndef NONSHARABLE_CLASS |
|
35 #define NONSHARABLE_CLASS(x) class x |
|
36 #endif |
|
37 |
|
38 // CLASS DEFINITION |
|
39 /** |
|
40 * |
|
41 * EUnitWizard generated test class. |
|
42 * |
|
43 */ |
|
44 NONSHARABLE_CLASS( UT_CGlxAttributeContext ) |
|
45 : public CEUnitTestSuiteClass |
|
46 { |
|
47 public: // Constructors and destructors |
|
48 |
|
49 /** |
|
50 * Two phase construction |
|
51 */ |
|
52 static UT_CGlxAttributeContext* NewL(); |
|
53 static UT_CGlxAttributeContext* NewLC(); |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 ~UT_CGlxAttributeContext(); |
|
58 |
|
59 private: // Constructors and destructors |
|
60 |
|
61 UT_CGlxAttributeContext(); |
|
62 void ConstructL(); |
|
63 |
|
64 public: // From observer interface |
|
65 |
|
66 |
|
67 private: // New methods |
|
68 |
|
69 void SetupL(); |
|
70 |
|
71 void Teardown(); |
|
72 |
|
73 void UT_CGlxAttributeContext_CGlxAttributeContextL(); |
|
74 |
|
75 |
|
76 void UT_CGlxAttributeContext_AddAttributeLL(); |
|
77 |
|
78 |
|
79 void UT_CGlxAttributeContext_RemoveAttributeL(); |
|
80 |
|
81 |
|
82 void UT_CGlxAttributeContext_AllAttributesLL(); |
|
83 |
|
84 |
|
85 void UT_CGlxAttributeContext_AttributeRequestLL(); |
|
86 |
|
87 void SetupAttributeRequestTestL(); |
|
88 void FetchItems_NoMediaL(); |
|
89 void FetchOneItem_IndexZeroL(); |
|
90 void FetchOneItem_IndexOneL(); |
|
91 void FetchOneItem_IndexTwoL(); |
|
92 void FetchOneItem_IndexThreeL(); |
|
93 void FetchOneItem_IndexFourL(); |
|
94 void FetchItems_GranularityLessThanRange_IndexZeroL(); |
|
95 void FetchItems_GranularityLessThanRange_IndexOneL(); |
|
96 void FetchItems_GranularityLessThanRange_IndexTwoL(); |
|
97 void FetchItems_GranularityLessThanRange_IndexThreeL(); |
|
98 void FetchItems_GranularityLessThanRange_IndexFourL(); |
|
99 void FetchItems_GranularityLessThanRange_IndexFiveL(); |
|
100 void FetchItems_GranularityGreaterThanRangeL(); |
|
101 TBool FindAttribute(RArray<TMPXAttribute>& aAttributes, const TMPXAttribute& aAttribute); |
|
102 |
|
103 private: // Data |
|
104 |
|
105 CGlxDefaultAttributeContext* iAttributeContext; |
|
106 |
|
107 EUNIT_DECLARE_TEST_TABLE; |
|
108 |
|
109 private: |
|
110 |
|
111 // Test media list |
|
112 class CGlxMediaListTest : public CBase, public MGlxMediaList |
|
113 { |
|
114 public: |
|
115 static CGlxMediaListTest* NewL(TUint aNumberOfMedia); |
|
116 |
|
117 virtual ~CGlxMediaListTest(); |
|
118 |
|
119 // From MGlxMediaList |
|
120 virtual void Close() {}; |
|
121 virtual TGlxMediaListId Id() const { return TGlxMediaListId(1); }; |
|
122 virtual TInt Count(NGlxListDefs::TCountType /*aType*/) const { return iItems.Count(); }; |
|
123 virtual TInt FocusIndex() const { return iFocusIndex; }; |
|
124 virtual void SetFocusL(NGlxListDefs::TFocusSetType /*aType*/, TInt aValue) { iFocusIndex = aValue; }; |
|
125 virtual const TGlxMedia& Item(TInt aIndex) const { return iItems[aIndex]; }; |
|
126 virtual TInt Index(const TGlxIdSpaceId& /* aIdSpaceId */, const TGlxMediaId& /*aId*/) const { return 0; }; |
|
127 virtual void AddMediaListObserverL(MGlxMediaListObserver* /*aObserver*/) {}; |
|
128 virtual void RemoveMediaListObserver(MGlxMediaListObserver* /*aObserver*/) {}; |
|
129 virtual void AddContextL(const MGlxFetchContext* /*aContext*/, TInt /*aPriority*/) {}; |
|
130 virtual void RemoveContext(const MGlxFetchContext* /*aContext*/) {}; |
|
131 virtual MMPXCollection& Collection() const { MMPXCollection* c = NULL; return *c; }; // Don't call |
|
132 virtual CMPXCollectionPath* PathLC(NGlxListDefs::TPathType /*aType*/) const { CMPXCollectionPath* p = NULL; return p; }; // Don't call |
|
133 virtual TBool IsSelected(TInt /*aIndex*/) const { return EFalse; }; |
|
134 virtual void SetSelectedL(TInt /*aIndex*/, TBool /*aSelected*/) {}; |
|
135 virtual TInt SelectionCount() const { return 0; }; |
|
136 virtual TInt SelectedItemIndex(TInt /*aSelectionIndex*/) const { return KErrNotFound; }; |
|
137 virtual void CommandL(CMPXCommand& /*aCommand*/) {}; |
|
138 virtual void CancelCommand() {}; |
|
139 virtual void SetFilterL(CMPXFilter* /*aFilter*/) {}; |
|
140 virtual CMPXFilter* Filter() const { return NULL; }; |
|
141 virtual TGlxIdSpaceId IdSpaceId(TInt /*aIndex*/) const { return KGlxIdNone; }; |
|
142 virtual TBool IsPopulated() const { return ETrue; }; // Don't call |
|
143 virtual void AddStaticItemL( CGlxMedia* /*aStaticItem*/, |
|
144 NGlxListDefs::TInsertionPosition /*aTargetPosition*/ ) {}; |
|
145 virtual void RemoveStaticItem(const TGlxMediaId& /*aItemId*/) {}; |
|
146 virtual void SetStaticItemsEnabled( TBool aEnabled ) { iStaticItemsEnabled = aEnabled; }; |
|
147 virtual TBool IsStaticItemsEnabled() const { return iStaticItemsEnabled; }; |
|
148 |
|
149 virtual void SetFocusInitialPosition(NGlxListDefs::TFocusInitialPosition /*aFocusInitialPosition*/) { }; |
|
150 virtual void ResetFocus(){ }; |
|
151 virtual void SetVisibleWindowIndexL( TInt /*aIndex*/) { }; |
|
152 virtual TInt VisibleWindowIndex() const { }; |
|
153 virtual void CancelPreviousRequests() {}; |
|
154 private: |
|
155 CGlxMediaListTest(); |
|
156 void ConstructL(TUint aNumberOfMedia); |
|
157 |
|
158 void CreateMediaL(TUint aMediaId); |
|
159 |
|
160 TInt iFocusIndex; |
|
161 RPointerArray<CGlxMedia> iMedias; |
|
162 RArray<TGlxMedia> iItems; |
|
163 RArray<TInt> iSelectedItems; |
|
164 TBool iStaticItemsEnabled; |
|
165 }; |
|
166 }; |
|
167 |
|
168 #endif // __UT_CGLXATTRIBUTECONTEXT_H__ |
|
169 |
|
170 // End of file |