|
1 /* |
|
2 * Copyright (c) 2006-2006 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: TGlxSelectionIterator unit tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __T_GLXSELECTIONITERATOR_H__ |
|
22 #define __T_GLXSELECTIONITERATOR_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/ceunittestsuiteclass.h> |
|
26 |
|
27 // INTERNAL INCLUDES |
|
28 #include "mglxmedialist.h" |
|
29 #include "glxmedialistiterator.h" |
|
30 #include "tmglxmedialist_stub.h" |
|
31 // FORWARD DECLARATIONS |
|
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( T_CGlxSelectionIterator ) |
|
45 : public CEUnitTestSuiteClass |
|
46 { |
|
47 public: // Constructors and destructors |
|
48 static T_CGlxSelectionIterator* NewL(); |
|
49 static T_CGlxSelectionIterator* NewLC(); |
|
50 ~T_CGlxSelectionIterator(); |
|
51 |
|
52 private: // Constructors and destructors |
|
53 T_CGlxSelectionIterator(); |
|
54 void ConstructL(); |
|
55 |
|
56 private: // New methods |
|
57 void SetupL(); |
|
58 void Teardown(); |
|
59 |
|
60 void UT_TestOperatorPlusPlusL(); |
|
61 void UT_TestInRangeL(); |
|
62 |
|
63 /** |
|
64 * Run a single test |
|
65 * @param aCount Number of items in list |
|
66 * @param aFocusIndex index of focus |
|
67 * @param aRange |
|
68 * @param aResult expected results in format "iiiii*e", |
|
69 * where i is an index, and e means KErrNotFound. |
|
70 * E.g., "14523ee" means iOrder++ should return 1 first, |
|
71 * 4 then, etc. and finally KErrNotFound two times |
|
72 */ |
|
73 void Test(TInt aRange, TBool aDisabledIfMoreThanRangeSelected, |
|
74 TInt aListCount, TInt aFocusIndex, RArray<TInt>& aSelection, const char* aResult); |
|
75 |
|
76 /** |
|
77 * Run a single "InRange()" test |
|
78 * @param aCount Number of items in list |
|
79 * @param aFocusIndex index of focus |
|
80 * @param aFrontOffset |
|
81 * @param aRearOffset |
|
82 * @param aResult expected results in format "xxx xx", |
|
83 * where x means the n-th item is in range, and space means it is not |
|
84 */ |
|
85 void TestSingleInRange(TInt aRange, TBool aDisabledIfMoreThanRangeSelected, |
|
86 TInt aListCount, TInt aFocusIndex, RArray<TInt>& aSelection, const char* aResult); |
|
87 |
|
88 private: // Data |
|
89 MGlxMediaListIterator* iVirtualIterator; // To access virtual functions only |
|
90 TMGlxMediaList_Stub iList; |
|
91 TGlxSelectionIterator iConcreateIterator; |
|
92 |
|
93 EUNIT_DECLARE_TEST_TABLE; |
|
94 }; |
|
95 |
|
96 #endif // __T_GLXSELECTIONITERATOR_H__ |