26 |
26 |
27 // Do this so we can access all member variables. |
27 // Do this so we can access all member variables. |
28 #define private public |
28 #define private public |
29 #include "MpSettingsAudioEffectsWidget.h" |
29 #include "MpSettingsAudioEffectsWidget.h" |
30 #undef private |
30 #undef private |
31 |
|
32 //This so we can test private functions |
|
33 //#include "../../src/mpsettingsaudioeffectswidget.cpp" |
|
34 |
|
35 |
|
36 |
31 |
37 /*! |
32 /*! |
38 Make our test case a stand-alone executable that runs all the test functions. |
33 Make our test case a stand-alone executable that runs all the test functions. |
39 */ |
34 */ |
40 int main(int argc, char *argv[]) |
35 int main(int argc, char *argv[]) |
108 mTest = 0; |
103 mTest = 0; |
109 MpEngineFactory::close(); |
104 MpEngineFactory::close(); |
110 } |
105 } |
111 |
106 |
112 /*! |
107 /*! |
113 Tests constructor. |
108 Tests InitializeSlider. |
114 */ |
109 */ |
115 void TestMpSettingsAudioEffectsWidget::testInitializeSlider() |
110 void TestMpSettingsAudioEffectsWidget::testInitializeSlider() |
116 { |
111 { |
|
112 //test slider widget is set up correctly in initialize() |
117 mTest->initialize(); |
113 mTest->initialize(); |
118 QVERIFY(mTest->mMpEngine != 0 ); |
114 QVERIFY(mTest->mMpEngine != 0 ); |
119 |
115 |
120 MpEngineFactory::sharedEngine()->setLoudness( false ); |
116 MpEngineFactory::sharedEngine()->setLoudness( false ); |
121 |
117 |
122 QCOMPARE(mTest->mModel->rowCount(),2 ); |
118 QCOMPARE(mTest->mModel->rowCount(),2 ); |
123 QCOMPARE(mTest->mModel->columnCount(),1 ); |
119 QCOMPARE(mTest->mModel->columnCount(),1 ); |
124 |
|
125 |
120 |
126 QCOMPARE( mTest->mModel->item( 0 )->type(), HbDataFormModelItem::SliderItem ); |
121 QCOMPARE( mTest->mModel->item( 0 )->type(), HbDataFormModelItem::SliderItem ); |
127 QCOMPARE( mTest->mModel->item( 1 )->type(), HbDataFormModelItem::ToggleValueItem ); |
122 QCOMPARE( mTest->mModel->item( 1 )->type(), HbDataFormModelItem::ToggleValueItem ); |
128 |
123 |
129 //slider |
124 //slider |
138 QCOMPARE( mTest->mModel->item( 0 )->contentWidgetData("sliderPosition"), QVariant(mTest->mMpEngine->balance()) ); //this needs to be checked |
133 QCOMPARE( mTest->mModel->item( 0 )->contentWidgetData("sliderPosition"), QVariant(mTest->mMpEngine->balance()) ); //this needs to be checked |
139 QCOMPARE( mTest->mModel->item( 0 )->contentWidgetData("trackFilled"), QVariant(false) ); |
134 QCOMPARE( mTest->mModel->item( 0 )->contentWidgetData("trackFilled"), QVariant(false) ); |
140 |
135 |
141 } |
136 } |
142 |
137 |
|
138 /*! |
|
139 Tests InitializeLoudnessOff. |
|
140 */ |
143 void TestMpSettingsAudioEffectsWidget::testInitializeLoudnessOff() |
141 void TestMpSettingsAudioEffectsWidget::testInitializeLoudnessOff() |
144 { |
142 { |
|
143 //test loudness HbDataFormModelItem is set up correctly in initialize() |
145 MpEngineFactory::sharedEngine()->setLoudness( false ); |
144 MpEngineFactory::sharedEngine()->setLoudness( false ); |
146 mTest->initialize(); |
145 mTest->initialize(); |
147 QVERIFY( mTest->mModel->item( 1 )->type() == HbDataFormModelItem::ToggleValueItem ); |
146 QVERIFY( mTest->mModel->item( 1 )->type() == HbDataFormModelItem::ToggleValueItem ); |
148 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("text"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_off" )) ); |
147 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("text"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_off" )) ); |
149 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("additionalText"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_on" )) ); |
148 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("additionalText"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_on" )) ); |
150 } |
149 } |
151 |
150 |
|
151 /*! |
|
152 Tests InitializeLoudnessOn. |
|
153 */ |
152 void TestMpSettingsAudioEffectsWidget::testInitializeLoudnessOn() |
154 void TestMpSettingsAudioEffectsWidget::testInitializeLoudnessOn() |
153 { |
155 { |
|
156 //test loudness HbDataFormModelItem is set up correctly in initialize() |
154 MpEngineFactory::sharedEngine()->setLoudness( true ); |
157 MpEngineFactory::sharedEngine()->setLoudness( true ); |
155 mTest->initialize(); |
158 mTest->initialize(); |
156 QVERIFY( mTest->mModel->item( 1 )->type() == HbDataFormModelItem::ToggleValueItem ); |
159 QVERIFY( mTest->mModel->item( 1 )->type() == HbDataFormModelItem::ToggleValueItem ); |
157 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("text"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_on" )) ); |
160 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("text"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_on" )) ); |
158 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("additionalText"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_off" )) ); |
161 QCOMPARE( mTest->mModel->item( 1 )->contentWidgetData("additionalText"), QVariant(hbTrId( "txt_mus_setlabel_loudness_val_off" )) ); |
159 |
162 |
160 } |
163 } |
161 |
164 |
162 |
165 /*! |
|
166 Tests FilterSignals. |
|
167 */ |
163 void TestMpSettingsAudioEffectsWidget::testFilterSignals() |
168 void TestMpSettingsAudioEffectsWidget::testFilterSignals() |
164 { |
169 { |
|
170 //filtersignals should not change loudness value |
165 MpEngineFactory::sharedEngine()->setLoudness( false ); |
171 MpEngineFactory::sharedEngine()->setLoudness( false ); |
166 mTest->initialize(); |
172 mTest->initialize(); |
167 QCOMPARE(MpEngineFactory::sharedEngine()->loudness(), false); |
|
168 QModelIndex index1 = mTest->mModel->indexFromItem((mTest->mModel->item(1))); |
173 QModelIndex index1 = mTest->mModel->indexFromItem((mTest->mModel->item(1))); |
169 mTest->filterSignals(index1,index1); |
174 mTest->filterSignals(index1,index1); |
170 QCOMPARE(MpEngineFactory::sharedEngine()->loudness(), true); |
175 QCOMPARE(MpEngineFactory::sharedEngine()->loudness(), false); |
|
176 |
171 } |
177 } |
172 |
178 |
173 |
179 |
174 |
180 |
|
181 |
175 // End of file |
182 // End of file |