homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/src/t_menuviewbuilder.cpp
changeset 98 e6f74eb7f69f
parent 97 66b5fe3c07fd
equal deleted inserted replaced
97:66b5fe3c07fd 98:e6f74eb7f69f
   147 {
   147 {
   148     HsMenuViewBuilder builder;
   148     HsMenuViewBuilder builder;
   149     builder.setStateContext(HsAllAppsContext);
   149     builder.setStateContext(HsAllAppsContext);
   150     builder.setOperationalContext(HsItemViewContext);
   150     builder.setOperationalContext(HsItemViewContext);
   151 
   151 
   152     const HbAbstractItemView *const itemView = builder.currentListView();
   152     const HbAbstractItemView *const itemView = builder.currentAbstractItemView();
   153 
   153 
   154     QVERIFY(itemView);
   154     QVERIFY(itemView);
   155     QVERIFY(itemView->inherits("HbListView"));
   155     QVERIFY(itemView->inherits("HbListView"));
   156     QVERIFY(itemView->itemRecycling());
   156     QVERIFY(itemView->itemRecycling());
   157     const bool visible = itemView->property("visible").toBool();
   157     const bool visible = itemView->property("visible").toBool();
   351 #ifdef UT_MEMORY_CHECK
   351 #ifdef UT_MEMORY_CHECK
   352     __UHEAP_MARK;
   352     __UHEAP_MARK;
   353 #endif//UT_MEMORY_CHECK
   353 #endif//UT_MEMORY_CHECK
   354 #endif//Q_OS_SYMBIAN
   354 #endif//Q_OS_SYMBIAN
   355     {
   355     {
   356     QFAIL("! Due to bug in hb wk36 we are forced to skip this test !");
       
   357         QScopedPointer<HbMainWindow> window(new HbMainWindow);
   356         QScopedPointer<HbMainWindow> window(new HbMainWindow);
   358         HsScene::setInstance( new HsScene(window.data()) );
   357         HsScene::setInstance( new HsScene(window.data()) );
   359 
   358 
   360         HsMenuViewBuilder builder;
   359         HsMenuViewBuilder builder;
   361         HsMenuModeWrapper menuMode;
   360         HsMenuModeWrapper menuMode;
   378         allAppsState->stateEntered();
   377         allAppsState->stateEntered();
   379         qApp->processEvents();
   378         qApp->processEvents();
   380 
   379 
   381         const int expectedRow(0);
   380         const int expectedRow(0);
   382 
   381 
   383         QVERIFY(allAppsState->mMenuView->listView() != NULL);
   382         QVERIFY(allAppsState->mMenuView->itemView() != NULL);
   384         QVERIFY(allAppsState->mMenuView->listView()->visibleItems().count() >= 1);
   383         QVERIFY(allAppsState->mMenuView->itemView()->visibleItems().count() >= 1);
   385 
   384 
   386         int actualRow =
   385         int actualRow =
   387             allAppsState->mMenuView->listView()->visibleItems().at(0)->modelIndex().row();
   386             allAppsState->mMenuView->itemView()->visibleItems().at(0)->modelIndex().row();
   388 
   387 
   389         QCOMPARE(actualRow, expectedRow);
   388         QCOMPARE(actualRow, expectedRow);
   390 
   389 
   391         allAppsState->mMenuView->scrollToRow(rowCount -1);
   390         allAppsState->mMenuView->scrollToRow(rowCount -1);
   392 
   391 
   393         actualRow =
   392         actualRow =
   394             allAppsState->mMenuView->listView()->visibleItems().at(0)->modelIndex().row();
   393             allAppsState->mMenuView->itemView()->visibleItems().at(0)->modelIndex().row();
   395 
   394 
   396         QVERIFY(actualRow != expectedRow);
   395         QVERIFY(actualRow != expectedRow);
   397         qApp->processEvents();
   396         qApp->processEvents();
   398 
   397 
   399         allAppsState->mMenuView->scrollToRow(expectedRow);
   398         allAppsState->mMenuView->scrollToRow(expectedRow);
   400 
   399 
   401         actualRow =
   400         actualRow =
   402             allAppsState->mMenuView->listView()->visibleItems().at(0)->modelIndex().row();
   401             allAppsState->mMenuView->itemView()->visibleItems().at(0)->modelIndex().row();
   403 
   402 
   404         QCOMPARE(actualRow, expectedRow);
   403         QCOMPARE(actualRow, expectedRow);
   405         qApp->processEvents();
   404         qApp->processEvents();
   406 
   405 
   407         allAppsState->stateExited();
   406         allAppsState->stateExited();