13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 #include "ut_infowidgetlayoutmanager.h" |
17 #include "ut_infowidgetlayoutmanager.h" |
18 |
|
19 #include <QGraphicsWidget> |
18 #include <QGraphicsWidget> |
20 #include <hbmarqueeitem.h> |
19 #include <hbmarqueeitem> |
|
20 #include <hbstyle> |
21 #define private public |
21 #define private public |
22 #include "infowidgetlayoutmanager.h" |
22 #include "infowidgetlayoutmanager.h" |
23 #include "qtestmains60.h" |
23 #include "qtestmains60.h" |
24 |
24 |
25 |
25 |
26 const int KNumOfSettingsDisplayRoles = 12; |
26 |
27 const int KNumOfInfoDisplayRoles = 8; |
27 const int KNumOfSettingsDisplayRoles = 6; |
|
28 const int KNumOfInfoDisplayRoles = 7; |
28 const QString KInfoWidgetDocmlFile = ":/resource/infowidget.docml"; |
29 const QString KInfoWidgetDocmlFile = ":/resource/infowidget.docml"; |
29 const QString KMargueeItemClassName = HbMarqueeItem::staticMetaObject.className(); |
30 const QString KMargueeItemClassName = HbMarqueeItem::staticMetaObject.className(); |
30 |
31 |
31 |
32 //class HbStyle; |
32 /*! |
33 /*! |
33 UT_InfoWidgetLayoutManager::UT_InfoWidgetLayoutManager |
34 UT_InfoWidgetLayoutManager::UT_InfoWidgetLayoutManager |
34 */ |
35 */ |
35 UT_InfoWidgetLayoutManager::UT_InfoWidgetLayoutManager() |
36 UT_InfoWidgetLayoutManager::UT_InfoWidgetLayoutManager() |
36 : |
37 : |
184 InfoWidgetLayoutManager::RoleSpnIcon)); |
185 InfoWidgetLayoutManager::RoleSpnIcon)); |
185 QVERIFY(0 <= roles.indexOf( |
186 QVERIFY(0 <= roles.indexOf( |
186 InfoWidgetLayoutManager::RoleMcnIcon)); |
187 InfoWidgetLayoutManager::RoleMcnIcon)); |
187 QVERIFY(0 <= roles.indexOf( |
188 QVERIFY(0 <= roles.indexOf( |
188 InfoWidgetLayoutManager::RoleSatTextIcon)); |
189 InfoWidgetLayoutManager::RoleSatTextIcon)); |
189 QVERIFY(0 <= roles.indexOf( |
|
190 InfoWidgetLayoutManager::RoleSettingsContainer)); |
|
191 } |
190 } |
192 |
191 |
193 activeLayout= m_layoutManager->layoutSettingsDisplay(); |
192 activeLayout= m_layoutManager->layoutSettingsDisplay(); |
194 QVERIFY(!activeLayout); |
193 QVERIFY(!activeLayout); |
195 |
194 |
220 QVERIFY(KLayoutRows == m_layoutManager->layoutRows()); |
219 QVERIFY(KLayoutRows == m_layoutManager->layoutRows()); |
221 } |
220 } |
222 |
221 |
223 /*! |
222 /*! |
224 UT_InfoWidgetLayoutManager::t_setLayoutRows |
223 UT_InfoWidgetLayoutManager::t_setLayoutRows |
225 *//* |
224 */ |
226 void UT_InfoWidgetLayoutManager::t_rowHeight() |
225 void UT_InfoWidgetLayoutManager::t_rowHeight() |
227 { |
226 { |
228 QVERIFY(m_layoutManager->rowHeight()); |
227 bool b = false; |
229 }*/ |
228 EXPECT(HbStyle::parameter).returns(b); |
|
229 m_layoutManager->rowHeight(); |
|
230 |
|
231 b = true; |
|
232 EXPECT(HbStyle::parameter).returns(b); |
|
233 m_layoutManager->rowHeight(); |
|
234 |
|
235 QVERIFY(verify()); |
|
236 } |
230 |
237 |
231 /*! |
238 /*! |
232 UT_InfoWidgetLayoutManager::t_layoutInfoDisplay |
239 UT_InfoWidgetLayoutManager::t_layoutInfoDisplay |
233 */ |
240 */ |
234 void UT_InfoWidgetLayoutManager::t_layoutInfoDisplay() |
241 void UT_InfoWidgetLayoutManager::t_layoutInfoDisplay() |
256 QVERIFY(settingDisplayRoles.count() == KNumOfSettingsDisplayRoles); |
263 QVERIFY(settingDisplayRoles.count() == KNumOfSettingsDisplayRoles); |
257 if (settingDisplayRoles.count() == KNumOfSettingsDisplayRoles) { |
264 if (settingDisplayRoles.count() == KNumOfSettingsDisplayRoles) { |
258 QVERIFY(0 <= settingDisplayRoles.indexOf( |
265 QVERIFY(0 <= settingDisplayRoles.indexOf( |
259 InfoWidgetLayoutManager::RoleContent)); |
266 InfoWidgetLayoutManager::RoleContent)); |
260 QVERIFY(0 <= settingDisplayRoles.indexOf( |
267 QVERIFY(0 <= settingDisplayRoles.indexOf( |
261 InfoWidgetLayoutManager::RoleMcnLabel)); |
268 InfoWidgetLayoutManager::RoleSpnCheckBox)); |
262 QVERIFY(0 <= settingDisplayRoles.indexOf( |
|
263 InfoWidgetLayoutManager::RoleSatTextLabel)); |
|
264 QVERIFY(0 <= settingDisplayRoles.indexOf( |
|
265 InfoWidgetLayoutManager::RoleMcnIcon)); |
|
266 QVERIFY(0 <= settingDisplayRoles.indexOf( |
|
267 InfoWidgetLayoutManager::RoleSatTextIcon)); |
|
268 QVERIFY(0 <= settingDisplayRoles.indexOf( |
269 QVERIFY(0 <= settingDisplayRoles.indexOf( |
269 InfoWidgetLayoutManager::RoleMcnCheckBox)); |
270 InfoWidgetLayoutManager::RoleMcnCheckBox)); |
270 QVERIFY(0 <= settingDisplayRoles.indexOf( |
271 QVERIFY(0 <= settingDisplayRoles.indexOf( |
271 InfoWidgetLayoutManager::RoleSatTextCheckBox)); |
272 InfoWidgetLayoutManager::RoleSatTextCheckBox)); |
272 QVERIFY(0 <= settingDisplayRoles.indexOf( |
273 QVERIFY(0 <= settingDisplayRoles.indexOf( |
273 InfoWidgetLayoutManager::RoleOkButton)); |
274 InfoWidgetLayoutManager::RoleOkButton)); |
274 QVERIFY(0 <= settingDisplayRoles.indexOf( |
|
275 InfoWidgetLayoutManager::RoleSpnLabel)); |
|
276 QVERIFY(0 <= settingDisplayRoles.indexOf( |
|
277 InfoWidgetLayoutManager::RoleSpnIcon)); |
|
278 QVERIFY(0 <= settingDisplayRoles.indexOf( |
|
279 InfoWidgetLayoutManager::RoleSpnCheckBox)); |
|
280 |
|
281 QVERIFY(0 <= settingDisplayRoles.indexOf( |
275 QVERIFY(0 <= settingDisplayRoles.indexOf( |
282 InfoWidgetLayoutManager::RoleSettingsContainer)); |
276 InfoWidgetLayoutManager::RoleSettingsContainer)); |
283 } |
277 } |
284 |
278 |
285 const QList<InfoWidgetLayoutManager::LayoutItemRole> infoDisplayRoles = |
279 const QList<InfoWidgetLayoutManager::LayoutItemRole> infoDisplayRoles = |
298 InfoWidgetLayoutManager::RoleSpnIcon)); |
292 InfoWidgetLayoutManager::RoleSpnIcon)); |
299 QVERIFY(0 <= infoDisplayRoles.indexOf( |
293 QVERIFY(0 <= infoDisplayRoles.indexOf( |
300 InfoWidgetLayoutManager::RoleMcnIcon)); |
294 InfoWidgetLayoutManager::RoleMcnIcon)); |
301 QVERIFY(0 <= infoDisplayRoles.indexOf( |
295 QVERIFY(0 <= infoDisplayRoles.indexOf( |
302 InfoWidgetLayoutManager::RoleSatTextIcon)); |
296 InfoWidgetLayoutManager::RoleSatTextIcon)); |
303 QVERIFY(0 <= infoDisplayRoles.indexOf( |
|
304 InfoWidgetLayoutManager::RoleSettingsContainer)); |
|
305 } |
297 } |
306 } |
298 } |
307 |
299 |
308 /*! |
300 /*! |
309 UT_InfoWidgetLayoutManager::t_loadWidgets |
301 UT_InfoWidgetLayoutManager::t_loadWidgets |
447 QVERIFY(!m_layoutManager->reloadWidgets(InfoWidgetLayoutManager::SettingsDisplay)); |
439 QVERIFY(!m_layoutManager->reloadWidgets(InfoWidgetLayoutManager::SettingsDisplay)); |
448 QVERIFY(!m_layoutManager->reloadWidgets((InfoWidgetLayoutManager::DisplayRole)101)); |
440 QVERIFY(!m_layoutManager->reloadWidgets((InfoWidgetLayoutManager::DisplayRole)101)); |
449 } |
441 } |
450 |
442 |
451 /*! |
443 /*! |
|
444 UT_InfoWidgetLayoutManager::t_destroyObjects |
|
445 */ |
|
446 void UT_InfoWidgetLayoutManager::t_destroyObjects() |
|
447 { |
|
448 m_layoutManager->destroyObjects(); |
|
449 |
|
450 QGraphicsWidget *widgetInfo = new QGraphicsWidget(); |
|
451 QGraphicsWidget *widgetSettings = new QGraphicsWidget(); |
|
452 m_layoutManager->m_infoDisplayWidgets.insert(InfoWidgetLayoutManager::RoleContent, widgetInfo); |
|
453 m_layoutManager->m_settingsDisplayWidgets.insert(InfoWidgetLayoutManager::RoleContent, widgetSettings); |
|
454 m_layoutManager->destroyObjects(); |
|
455 |
|
456 QVERIFY(verify()); |
|
457 } |
|
458 |
|
459 /*! |
452 UT_InfoWidgetLayoutManager::t_createObject |
460 UT_InfoWidgetLayoutManager::t_createObject |
453 */ |
461 */ |
454 void UT_InfoWidgetLayoutManager::t_createObject() |
462 void UT_InfoWidgetLayoutManager::t_createObject() |
455 { |
463 { |
456 QObject *object = m_documentLoader->createObject(QString(), QString()); |
464 QObject *object = m_documentLoader->createObject(QString(), QString()); |