phoneplugins/infowidgetplugin/tsrc/ut_infowidgetlayoutmanager/src/ut_infowidgetlayoutmanager.cpp
changeset 60 1eef62f5c541
parent 50 377c906a8701
equal deleted inserted replaced
53:22cc52eade9b 60:1eef62f5c541
   125     
   125     
   126     QObjectList objectList;
   126     QObjectList objectList;
   127     QGraphicsWidget widget;
   127     QGraphicsWidget widget;
   128     
   128     
   129     bool loaded = true;
   129     bool loaded = true;
   130     EXPECT(HbDocumentLoader::load)
   130     EXPECT(HbDocumentLoader, load)
   131             .with(KInfoWidgetDocmlFile, loaded)
   131             .with(KInfoWidgetDocmlFile, loaded)
   132             .returns(&objectList);
   132             .returns(&objectList);
   133     EXPECT(HbDocumentLoader::findWidget).times(KNumOfInfoDisplayRoles).returns(&widget);
   133     EXPECT(HbDocumentLoader, findWidget).times(KNumOfInfoDisplayRoles).returns(&widget);
   134     
   134     
   135     QGraphicsWidget *activeWidget = m_layoutManager->layoutInfoDisplay();
   135     QGraphicsWidget *activeWidget = m_layoutManager->layoutInfoDisplay();
   136     
   136     
   137     QVERIFY(activeWidget);
   137     QVERIFY(activeWidget);
   138     
   138     
   154             InfoWidgetLayoutManager::RoleMcnIcon));
   154             InfoWidgetLayoutManager::RoleMcnIcon));
   155         QVERIFY(0 <= roles.indexOf(
   155         QVERIFY(0 <= roles.indexOf(
   156             InfoWidgetLayoutManager::RoleSatTextIcon));
   156             InfoWidgetLayoutManager::RoleSatTextIcon));
   157     }
   157     }
   158     
   158     
   159     EXPECT(HbDocumentLoader::load)
   159     EXPECT(HbDocumentLoader, load)
   160                 .with(KSettingsDialogDocmlFile, loaded)
   160                 .with(KSettingsDialogDocmlFile, loaded)
   161                 .returns(&objectList);
   161                 .returns(&objectList);
   162     EXPECT(HbDocumentLoader::findWidget).times(KNumOfSettingsDisplayRoles).returns(&widget);
   162     EXPECT(HbDocumentLoader, findWidget).times(KNumOfSettingsDisplayRoles).returns(&widget);
   163     
   163     
   164     QObject action;
   164     QObject action;
   165     EXPECT(HbDocumentLoader::findObject).times(2).returns(&action);
   165     EXPECT(HbDocumentLoader, findObject).times(2).returns(&action);
   166     
   166     
   167     activeWidget = m_layoutManager->layoutSettingsDialog();
   167     activeWidget = m_layoutManager->layoutSettingsDialog();
   168     
   168     
   169     QVERIFY(activeWidget);
   169     QVERIFY(activeWidget);
   170 
   170 
   179   UT_InfoWidgetLayoutManager::t_rowHeight
   179   UT_InfoWidgetLayoutManager::t_rowHeight
   180  */
   180  */
   181 void UT_InfoWidgetLayoutManager::t_rowHeight()
   181 void UT_InfoWidgetLayoutManager::t_rowHeight()
   182 {
   182 {
   183     bool b = false;
   183     bool b = false;
   184     EXPECT(HbStyle::parameter).returns(b);
   184     EXPECT(HbStyle, parameter).returns(b);
   185     m_layoutManager->layoutRowHeight();
   185     m_layoutManager->layoutRowHeight();
   186     
   186     
   187     b = true;
   187     b = true;
   188     EXPECT(HbStyle::parameter).returns(b);
   188     EXPECT(HbStyle, parameter).returns(b);
   189     m_layoutManager->layoutRowHeight();
   189     m_layoutManager->layoutRowHeight();
   190     
   190     
   191     QVERIFY(verify()); 
   191     QVERIFY(verify()); 
   192 }
   192 }
   193 
   193 
   199 {
   199 {
   200     QObjectList objectList;
   200     QObjectList objectList;
   201     QGraphicsWidget widget;
   201     QGraphicsWidget widget;
   202         
   202         
   203     bool loaded = true;
   203     bool loaded = true;
   204     EXPECT(HbDocumentLoader::load)
   204     EXPECT(HbDocumentLoader, load)
   205             .with(KInfoWidgetDocmlFile, loaded)
   205             .with(KInfoWidgetDocmlFile, loaded)
   206             .returns(&objectList);
   206             .returns(&objectList);
   207     EXPECT(HbDocumentLoader::findWidget).times(KNumOfInfoDisplayRoles).returns(&widget);
   207     EXPECT(HbDocumentLoader, findWidget).times(KNumOfInfoDisplayRoles).returns(&widget);
   208     
   208     
   209     QVERIFY(m_layoutManager->layoutInfoDisplay());
   209     QVERIFY(m_layoutManager->layoutInfoDisplay());
   210 }
   210 }
   211 
   211 
   212 
   212 
   217 {
   217 {
   218     QObjectList objectList;
   218     QObjectList objectList;
   219     QGraphicsWidget widget;
   219     QGraphicsWidget widget;
   220         
   220         
   221     bool loaded = true;
   221     bool loaded = true;
   222     EXPECT(HbDocumentLoader::load)
   222     EXPECT(HbDocumentLoader, load)
   223             .with(KSettingsDialogDocmlFile, loaded)
   223             .with(KSettingsDialogDocmlFile, loaded)
   224             .returns(&objectList);
   224             .returns(&objectList);
   225     EXPECT(HbDocumentLoader::findWidget).times(KNumOfSettingsDisplayRoles).returns(&widget);
   225     EXPECT(HbDocumentLoader, findWidget).times(KNumOfSettingsDisplayRoles).returns(&widget);
   226     QObject action;
   226     QObject action;
   227     EXPECT(HbDocumentLoader::findObject).times(2).returns(&action);
   227     EXPECT(HbDocumentLoader, findObject).times(2).returns(&action);
   228     
   228     
   229     QVERIFY(m_layoutManager->layoutSettingsDialog());
   229     QVERIFY(m_layoutManager->layoutSettingsDialog());
   230 }
   230 }
   231 
   231 
   232 
   232 
   280 void UT_InfoWidgetLayoutManager::t_loadWidgets()
   280 void UT_InfoWidgetLayoutManager::t_loadWidgets()
   281 {
   281 {
   282     QObjectList objectList;
   282     QObjectList objectList;
   283     QGraphicsWidget widget;
   283     QGraphicsWidget widget;
   284     bool loaded = true;
   284     bool loaded = true;
   285     EXPECT(HbDocumentLoader::load)
   285     EXPECT(HbDocumentLoader, load)
   286             .with(KSettingsDialogDocmlFile, loaded)
   286             .with(KSettingsDialogDocmlFile, loaded)
   287             .returns(&objectList);
   287             .returns(&objectList);
   288     QObject action;
   288     QObject action;
   289     EXPECT(HbDocumentLoader::findObject).times(2).returns(&action);
   289     EXPECT(HbDocumentLoader, findObject).times(2).returns(&action);
   290     EXPECT(HbDocumentLoader::findWidget).times(KNumOfSettingsDisplayRoles).returns(&widget);
   290     EXPECT(HbDocumentLoader, findWidget).times(KNumOfSettingsDisplayRoles).returns(&widget);
   291     bool loadResult = m_layoutManager->loadWidgets(InfoWidgetLayoutManager::SettingsDialog);
   291     bool loadResult = m_layoutManager->loadWidgets(InfoWidgetLayoutManager::SettingsDialog);
   292 
   292 
   293     QVERIFY(loadResult);
   293     QVERIFY(loadResult);
   294 }
   294 }
   295 
   295 
   351     
   351     
   352     objectRoles.append(InfoWidgetLayoutManager::RoleOkAction); 
   352     objectRoles.append(InfoWidgetLayoutManager::RoleOkAction); 
   353     QObject *cancelAction = new QObject; 
   353     QObject *cancelAction = new QObject; 
   354 
   354 
   355     // Test: 
   355     // Test: 
   356     EXPECT(HbDocumentLoader::findObject).with(QString("sd:cancelAction")).returns(cancelAction);
   356     EXPECT(HbDocumentLoader, findObject).with(QString("sd:cancelAction")).returns(cancelAction);
   357     EXPECT(HbDocumentLoader::findObject).with(QString("sd:okAction")).returns(okAction);
   357     EXPECT(HbDocumentLoader, findObject).with(QString("sd:okAction")).returns(okAction);
   358     
   358     
   359     foreach(currentRole, objectRoles) {
   359     foreach(currentRole, objectRoles) {
   360         currentObject = m_layoutManager->loadObject(*m_documentLoader,
   360         currentObject = m_layoutManager->loadObject(*m_documentLoader,
   361                 InfoWidgetLayoutManager::SettingsDialog, 
   361                 InfoWidgetLayoutManager::SettingsDialog, 
   362                 currentRole);
   362                 currentRole);