author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 00:17:30 +0300 | |
changeset 53 | bb6ed1806599 |
parent 50 | c44f9bb56771 |
permissions | -rw-r--r-- |
24 | 1 |
/* |
2 |
* Copyright (c) 2009 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef T_RADIOSTATION_H_ |
|
20 |
#define T_RADIOSTATION_H_ |
|
21 |
||
22 |
||
23 |
// INCLUDES |
|
24 |
#include <QtTest/QtTest> |
|
25 |
||
26 |
#include "radioenginewrapperobserver.h" |
|
27 |
#include "radiostation.h" |
|
53
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
28 |
#include "t_schedulerstartandstoptimer.h" |
24 | 29 |
|
30 |
class RadioUiEngine; |
|
31 |
class RadioStationModel; |
|
32 |
class RadioHistoryModel; |
|
33 |
class RadioPresetStorage; |
|
34 |
class RadioEngineWrapper; |
|
35 |
class RadioEngineWrapperObserver; |
|
36 |
||
53
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
37 |
class TestRadioUiEngine : public QObject, RadioEngineWrapperObserver, MSchedulerStartAndStopTimerObserver |
24 | 38 |
{ |
39 |
Q_OBJECT |
|
40 |
||
41 |
/** |
|
42 |
* Flags to indicate which slots have been entered since calling API method. |
|
43 |
* Declared to use QFlags<> to ease flag usage and to enforce type safety. |
|
44 |
*/ |
|
45 |
enum SlotEnteredFlag |
|
46 |
{ |
|
47 |
NoSlotsEntered = 0 |
|
48 |
,StationDataChanged = 1 << 0 |
|
49 |
,FavoriteChanged = 1 << 1 |
|
50
c44f9bb56771
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
50 |
,DataChanged = 1 << 2 |
c44f9bb56771
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
51 |
,ItemAdded = 1 << 3 |
24 | 52 |
}; |
53 |
Q_DECLARE_FLAGS( Slots, SlotEnteredFlag ) |
|
54 |
||
55 |
public: |
|
56 |
||
57 |
TestRadioUiEngine(); |
|
58 |
~TestRadioUiEngine(); |
|
59 |
||
60 |
public slots: |
|
61 |
void dataChanged(const QModelIndex topLeft, const QModelIndex bottomRight); |
|
62 |
void stationDataChanged( RadioStation station ); |
|
63 |
void favoriteChanged( RadioStation station ); |
|
64 |
void itemAdded(); |
|
65 |
||
66 |
private slots: |
|
67 |
// test framework called slots |
|
68 |
void initTestCase(); |
|
69 |
void init(); |
|
70 |
void cleanup(); |
|
71 |
void cleanupTestCase(); |
|
72 |
void testImplicitSharing(); |
|
73 |
void testChangeFlags(); |
|
74 |
void TestCallSignChar(); |
|
75 |
void testPICodeToCallSign(); |
|
76 |
void testRadioStationModel(); |
|
77 |
void testhistoryModel(); |
|
78 |
void testHistoryModelItem(); |
|
79 |
||
80 |
private: |
|
81 |
||
82 |
// from base class RadioEngineWrapperObserver |
|
83 |
void tunedToFrequency( uint frequency, int commandSender ); |
|
50
c44f9bb56771
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
84 |
void seekingStarted( Seek::Direction direction ); |
24 | 85 |
void radioStatusChanged( bool radioIsOn ); |
86 |
void rdsAvailabilityChanged( bool available ); |
|
87 |
void volumeChanged( int volume ); |
|
88 |
void muteChanged( bool muted ); |
|
89 |
void audioRouteChanged( bool loudspeaker ); |
|
90 |
void scanAndSaveFinished(); |
|
91 |
void headsetStatusChanged( bool connected ); |
|
92 |
void skipPrevious(); |
|
93 |
void skipNext(); |
|
53
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
94 |
|
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
95 |
// from base class MSchedulerStartAndStopTimerObserver => |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
96 |
void Timeout( TUint aTimerId ); |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
97 |
void CreateMUT(); |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
98 |
void DeleteMUT(); |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
99 |
// <= |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
100 |
|
24 | 101 |
// subfunctions used by the test framework called slots |
102 |
void testRadioStationModelInit(); |
|
103 |
void testAddStation1(); |
|
104 |
void testSaveStation1(); |
|
105 |
void testAddStation2(); |
|
106 |
void testSaveStation2(); |
|
107 |
void testAddStation3(); |
|
108 |
void testSaveStation3(); |
|
109 |
void testSortByFrequency(); |
|
110 |
void testFindPresetIndex(); |
|
111 |
void testRemoveByFrequency(); |
|
112 |
void testRemoveByPresetIndex(); |
|
113 |
void testRemoveStation(); |
|
114 |
||
115 |
void testSetFavorite(); |
|
116 |
||
117 |
void testRenameStation(); |
|
118 |
void testSetRadioTextPlus(); |
|
119 |
void testHistoryModelInit(); |
|
120 |
void testHistoryModelAddItem(); |
|
121 |
void testAddRadioTextPlus(); |
|
122 |
void testClearRadioTextPlus(); |
|
123 |
void testRadioHistoryItem(); |
|
124 |
||
125 |
private: |
|
126 |
RadioUiEngine* mUiEngine; |
|
127 |
QScopedPointer<RadioEngineWrapper> mEngineWrapper; |
|
128 |
QScopedPointer<RadioPresetStorage> mPresetStorage; |
|
129 |
int mExpectedStationCount; |
|
130 |
/** |
|
131 |
* Internal book keeping used to determine which slots have been entered since calling RadioStationModel |
|
132 |
* API method. Used to conclude if the correct signals from RadioStationModel have been received. |
|
133 |
*/ |
|
134 |
Slots mEnteredSlots; |
|
135 |
QString mStationToBeAdded; |
|
136 |
QString mStationToBeSaved; |
|
53
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
137 |
CSchedulerStopAndStartTimer* mSchedulerTimer; |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
138 |
// Active scheduler |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
139 |
// Workaround for the below panic, occured after porting to 10.1 |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
140 |
// Main Panic E32USER-CBase 44 |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
141 |
// Create and install the active scheduler |
bb6ed1806599
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
142 |
CActiveScheduler* mScheduler; |
24 | 143 |
}; |
144 |
||
145 |
#endif /* T_RADIOSTATION_H_ */ |