homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_menuviewbuilder/src/t_menuviewbuilder.cpp
changeset 90 3ac3aaebaee5
child 97 66b5fe3c07fd
equal deleted inserted replaced
86:e4f038c420f7 90:3ac3aaebaee5
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Main test class for hsHomeScreenStatePlugin library.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <hbmainwindow.h>
       
    19 #include <hbinstance.h>
       
    20 #include <hbview.h>
       
    21 #include <hblistview.h>
       
    22 #include <hblistviewitem.h>
       
    23 #include <qscopedpointer>
       
    24 #include <hbaction.h>
       
    25 #include <hbgridview.h>
       
    26 #include <hbgroupbox.h>
       
    27 #include <hbtoolbar.h>
       
    28 #include <qsortfilterproxymodel.h>
       
    29 #include <HbShrinkingVkbHost>
       
    30 
       
    31 #include "caentry.h"
       
    32 #include "caitemmodel.h"
       
    33 #include "hsmenuview.h"
       
    34 #include "hsmenuevent.h"
       
    35 #include "hsmenuviewbuilder.h"
       
    36 #include "hssearchviewbuilder.h"
       
    37 #include "hsmenueventtransition.h"
       
    38 #include "hsallcollectionsstate.h"
       
    39 #include "hsapplibrarystate.h"
       
    40 #include "hsallappsstate.h"
       
    41 #include "hslistviewitem.h"
       
    42 
       
    43 #include "t_hsaddtohomescreenmockstate.h"
       
    44 #include "t_hsmockmodel.h"
       
    45 #include "t_menuviewbuilder.h"
       
    46 
       
    47 
       
    48 
       
    49 void MenuStatesTest::cleanup()
       
    50 {
       
    51     qApp->processEvents();
       
    52 }
       
    53 
       
    54 class HsMainWindowMock : public HsMainWindow
       
    55 {
       
    56     virtual void setCurrentView(HbView *view);
       
    57 
       
    58 };
       
    59 
       
    60 void HsMainWindowMock::setCurrentView(HbView *view)
       
    61 {
       
    62     Q_UNUSED(view);
       
    63     // do nothing
       
    64 }
       
    65 
       
    66 class HsMainWindowSpy: public HsMainWindow
       
    67 {
       
    68 public:
       
    69     virtual void setCurrentView(HbView *view)
       
    70     {
       
    71         mSwitchedToView = view;
       
    72     }
       
    73 
       
    74     HbView *mSwitchedToView;
       
    75 
       
    76     HsMainWindowSpy(): mSwitchedToView(NULL) {};
       
    77 };
       
    78 
       
    79 void MenuStatesTest::HsMenuViewBuilder_construction()
       
    80 {
       
    81     const HsMenuViewBuilder builder;
       
    82     QList<QAction *> expectedActionList;
       
    83     expectedActionList << builder.allAppsAction();
       
    84     expectedActionList << builder.allCollectionsAction();
       
    85     expectedActionList << builder.searchAction();
       
    86 
       
    87     QList<QAction *> actualActionList(builder.toolBar()->actions());
       
    88 
       
    89     QCOMPARE(actualActionList, expectedActionList);
       
    90 
       
    91 }
       
    92 
       
    93 void MenuStatesTest::HsMenuViewBuilder_view()
       
    94 {
       
    95     HsMenuViewBuilder builder;
       
    96     const HbView *view = builder.currentView();
       
    97 
       
    98     builder.setStateContext(HsAllAppsContext);
       
    99     builder.setOperationalContext(HsItemViewContext);
       
   100 
       
   101     view = builder.currentView();
       
   102 
       
   103     QVERIFY(view != NULL);
       
   104     QCOMPARE(view->objectName(), QString("view"));
       
   105     QString title = view->title();
       
   106     QCOMPARE(title, hbTrId("txt_applib_title_applications"));
       
   107 
       
   108     view = builder.currentView();
       
   109 
       
   110     builder.setOperationalContext(HsEmptyLabelContext);
       
   111     QVERIFY(view != NULL);
       
   112     QCOMPARE(view->objectName(), QString("view"));
       
   113     title = view->title();
       
   114     QCOMPARE(title, hbTrId("txt_applib_title_applications"));
       
   115 }
       
   116 
       
   117 void MenuStatesTest::HsMenuViewBuilder_listView()
       
   118 {
       
   119     HsMenuViewBuilder builder;
       
   120     builder.setStateContext(HsAllAppsContext);
       
   121     builder.setOperationalContext(HsItemViewContext);
       
   122 
       
   123     const HbAbstractItemView *const itemView = builder.currentListView();
       
   124 
       
   125     QVERIFY(itemView);
       
   126     QVERIFY(itemView->inherits("HbListView"));
       
   127     QVERIFY(itemView->itemRecycling());
       
   128     const bool visible = itemView->property("visible").toBool();
       
   129     QVERIFY(visible);
       
   130 }
       
   131 
       
   132 void MenuStatesTest::HsMenuViewBuilder_label()
       
   133 {
       
   134     HsMenuViewBuilder builder;
       
   135 
       
   136     const HbGroupBox *const allAppsLabel = builder.currentViewLabel();
       
   137 
       
   138     QVERIFY(allAppsLabel == NULL || !allAppsLabel->isVisible());
       
   139 
       
   140     builder.setStateContext(HsInstalledAppsContext);
       
   141 
       
   142     const HbGroupBox *const collectionLabel = builder.currentViewLabel();
       
   143 
       
   144     QVERIFY(collectionLabel != NULL);
       
   145     QVERIFY(collectionLabel->isVisible());
       
   146     QCOMPARE(collectionLabel->fontSpec().role(), HbFontSpec::Title);
       
   147     QCOMPARE(collectionLabel->marqueeHeading(), true);
       
   148 }
       
   149 
       
   150 void MenuStatesTest::HsMenuViewBuilder_allAppsAction()
       
   151 {
       
   152     const HsMenuViewBuilder builder;
       
   153     const HbAction *const action = builder.allAppsAction();
       
   154 
       
   155     QVERIFY(action != NULL);
       
   156     QCOMPARE(action->icon().iconName(),
       
   157              QString("qtg_mono_applications_all"));
       
   158 
       
   159 }
       
   160 
       
   161 void MenuStatesTest::HsMenuViewBuilder_allCollectionsAction()
       
   162 {
       
   163     const HsMenuViewBuilder builder;
       
   164     const HbAction *const action = builder.allCollectionsAction();
       
   165 
       
   166     QVERIFY(action != NULL);
       
   167     QCOMPARE(action->icon().iconName(),
       
   168              QString("qtg_mono_applications_collections"));
       
   169 }
       
   170 
       
   171 void MenuStatesTest::HsMenuViewBuilder_searchAction()
       
   172 {
       
   173     const HsMenuViewBuilder builder;
       
   174     const HbAction *const action = builder.searchAction();
       
   175 
       
   176     QVERIFY(action != NULL);
       
   177     QCOMPARE(action->icon().iconName(),
       
   178              QString("qtg_mono_search"));
       
   179 }
       
   180 
       
   181 void MenuStatesTest::HsMenuViewBuilder_oviStoreAction()
       
   182 {
       
   183     const HsMenuViewBuilder builder;
       
   184     const HbAction *const action = builder.oviStoreAction();
       
   185 
       
   186     QVERIFY(action != NULL);
       
   187     QCOMPARE(action->icon().iconName(),
       
   188              QString("qtg_mono_ovistore"));
       
   189 }
       
   190 
       
   191 void MenuStatesTest::HsMenuViewBuilder_operatorAction()
       
   192 {
       
   193     const HsMenuViewBuilder builder;
       
   194     const HbAction *const action = builder.operatorAction();
       
   195 
       
   196     QVERIFY(action != NULL);
       
   197     //we do not have operator icon name
       
   198     //QCOMPARE(action->icon().iconName(),
       
   199     //             QString("qtg_mono_store"));
       
   200 }
       
   201 
       
   202 void MenuStatesTest::HsMenuViewBuilder_toolBar()
       
   203 {
       
   204     HsMenuViewBuilder builder;
       
   205     HbToolBar *toolBar = builder.toolBar();
       
   206 
       
   207     QVERIFY(toolBar != 0);
       
   208     QCOMPARE(toolBar->orientation(), Qt::Horizontal);
       
   209 
       
   210     const QList<QAction *> actions = toolBar->actions();
       
   211 
       
   212     QCOMPARE(actions.count(), 3);
       
   213     QCOMPARE(actions.at(0),
       
   214              static_cast<QAction *>(builder.allAppsAction()));
       
   215     QCOMPARE(actions.at(1),
       
   216              static_cast<QAction *>(builder.allCollectionsAction()));
       
   217     QCOMPARE(actions.at(2),
       
   218              static_cast<QAction *>(builder.searchAction()));
       
   219     QCOMPARE(toolBar, builder.currentView()->toolBar());
       
   220 }
       
   221 
       
   222 void MenuStatesTest::HsMenuViewBuilder_toolBarExtension()
       
   223 {
       
   224     HsMenuViewBuilder builder;
       
   225     HbToolBarExtension *toolBarExtension = builder.toolBarExtension();
       
   226 
       
   227     QVERIFY(toolBarExtension);
       
   228 }
       
   229 
       
   230 
       
   231 
       
   232 
       
   233 // ---------------------------------------------------------------------------
       
   234 // ---------------------------------------------------------------------------
       
   235 //
       
   236 void MenuStatesTest::MenuView_slots()
       
   237 {
       
   238 #ifdef Q_OS_SYMBIAN
       
   239     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   240 #ifdef UT_MEMORY_CHECK
       
   241     __UHEAP_MARK;
       
   242 #endif//UT_MEMORY_CHECK
       
   243 #endif//Q_OS_SYMBIAN
       
   244     {
       
   245         HsMenuViewBuilder builder;
       
   246         HsMainWindowMock mainWindow;
       
   247         HsMenuView menuView(builder, HsAllAppsContext, mainWindow);
       
   248 
       
   249         connect(&menuView,
       
   250                 SIGNAL(activated(QModelIndex)),
       
   251                 this,
       
   252                 SLOT(testslot_activated(QModelIndex)));
       
   253         connect(&menuView,
       
   254                 SIGNAL(longPressed(HbAbstractViewItem *, QPointF)),
       
   255                 this,
       
   256                 SLOT(testslot_longpressed(HbAbstractViewItem *, QPointF)));
       
   257 
       
   258         emit menuView.activated(QModelIndex());
       
   259 
       
   260         QScopedPointer<HbListViewItem> item(new HbListViewItem());
       
   261 
       
   262         emit menuView.longPressed(item.data(), QPoint(50,50));
       
   263 
       
   264         QCOMPARE(mIndex, QModelIndex());
       
   265         QVERIFY(item.data()  == mItem);
       
   266         QCOMPARE(mPoint.x(), double(50));
       
   267         QCOMPARE(mPoint.y(), double(50));
       
   268 
       
   269         disconnect(&menuView,
       
   270                    SIGNAL(activated(QModelIndex)),
       
   271                    this,
       
   272                    SLOT(testslot_activated(QModelIndex)));
       
   273         disconnect(&menuView,
       
   274                    SIGNAL(longPressed(HbAbstractViewItem *, QPointF)),
       
   275                    this,
       
   276                    SLOT(testslot_longpressed(HbAbstractViewItem *, QPointF)));
       
   277     }
       
   278 #ifdef Q_OS_SYMBIAN
       
   279 #ifdef UT_MEMORY_CHECK
       
   280     __UHEAP_MARKEND;
       
   281 #endif//UT_MEMORY_CHECK
       
   282 #endif//Q_OS_SYMBIAN
       
   283 }
       
   284 
       
   285 
       
   286 // ---------------------------------------------------------------------------
       
   287 // ---------------------------------------------------------------------------
       
   288 //
       
   289 void MenuStatesTest::HsMenuView_scrolling()
       
   290 {
       
   291 #ifdef Q_OS_SYMBIAN
       
   292 #ifdef UT_MEMORY_CHECK
       
   293     __UHEAP_MARK;
       
   294 #endif//UT_MEMORY_CHECK
       
   295 #endif//Q_OS_SYMBIAN
       
   296     {
       
   297         QScopedPointer<HbMainWindow> wind(new HbMainWindow);
       
   298         HsMenuViewBuilder builder;
       
   299         HsMenuModeWrapper menuMode;
       
   300         HsMainWindow mainWindow;
       
   301 
       
   302         QScopedPointer<QState> parent(new QState);
       
   303 
       
   304 
       
   305         HsAllAppsState *allAppsState = new HsAllAppsState(builder,
       
   306                 menuMode, mainWindow, parent.data());
       
   307 
       
   308         wind->addView(builder.currentView());
       
   309 
       
   310 
       
   311         QVERIFY(allAppsState->mModel != 0);
       
   312         const int rowCount = allAppsState->mModel->rowCount();
       
   313         QVERIFY(rowCount > 0);
       
   314 
       
   315         allAppsState->scrollToBeginning();
       
   316         allAppsState->stateEntered();
       
   317         qApp->processEvents();
       
   318 
       
   319         const int expectedRow(0);
       
   320 
       
   321         QVERIFY(allAppsState->mMenuView->listView() != NULL);
       
   322         QVERIFY(allAppsState->mMenuView->listView()->visibleItems().count() >= 1);
       
   323 
       
   324         int actualRow =
       
   325             allAppsState->mMenuView->listView()->visibleItems().at(0)->modelIndex().row();
       
   326 
       
   327         QCOMPARE(actualRow, expectedRow);
       
   328 
       
   329         allAppsState->mMenuView->scrollToRow(rowCount -1);
       
   330 
       
   331         actualRow =
       
   332             allAppsState->mMenuView->listView()->visibleItems().at(0)->modelIndex().row();
       
   333 
       
   334         QVERIFY(actualRow != expectedRow);
       
   335         qApp->processEvents();
       
   336 
       
   337         allAppsState->mMenuView->scrollToRow(expectedRow);
       
   338 
       
   339         actualRow =
       
   340             allAppsState->mMenuView->listView()->visibleItems().at(0)->modelIndex().row();
       
   341 
       
   342         QCOMPARE(actualRow, expectedRow);
       
   343         qApp->processEvents();
       
   344 
       
   345        allAppsState->stateExited();
       
   346 
       
   347         qApp->processEvents();
       
   348     }
       
   349 #ifdef Q_OS_SYMBIAN
       
   350 #ifdef UT_MEMORY_CHECK
       
   351     __UHEAP_MARKEND;
       
   352 #endif//UT_MEMORY_CHECK
       
   353 #endif//Q_OS_SYMBIAN
       
   354 }
       
   355 
       
   356 
       
   357 // ---------------------------------------------------------------------------
       
   358 // ---------------------------------------------------------------------------
       
   359 //
       
   360 void MenuStatesTest::MenuView_toolBarExtension()
       
   361 {
       
   362 #ifdef Q_OS_SYMBIAN
       
   363     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   364 #ifdef UT_MEMORY_CHECK
       
   365     __UHEAP_MARK;
       
   366 #endif//UT_MEMORY_CHECK
       
   367 #endif//Q_OS_SYMBIAN
       
   368     {
       
   369         HsMenuViewBuilder menuViewBuilder;
       
   370         HbToolBarExtension *toolBarExtension = menuViewBuilder.toolBarExtension();
       
   371         QVERIFY(toolBarExtension != NULL);
       
   372     }
       
   373 #ifdef Q_OS_SYMBIAN
       
   374 #ifdef UT_MEMORY_CHECK
       
   375     __UHEAP_MARKEND;
       
   376 #endif//UT_MEMORY_CHECK
       
   377 #endif//Q_OS_SYMBIAN
       
   378 }
       
   379 
       
   380 // ---------------------------------------------------------------------------
       
   381 // ---------------------------------------------------------------------------
       
   382 //
       
   383 void MenuStatesTest::MenuView_reset()
       
   384 {
       
   385 #ifdef Q_OS_SYMBIAN
       
   386     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   387 #ifdef UT_MEMORY_CHECK
       
   388     __UHEAP_MARK;
       
   389 #endif//UT_MEMORY_CHECK
       
   390 #endif//Q_OS_SYMBIAN
       
   391     {
       
   392         HsMenuViewBuilder builder;
       
   393         HsMainWindowMock mainWindow;
       
   394         HsMenuView menuView(builder, HsCollectionContext, mainWindow);
       
   395 
       
   396         QVERIFY(menuView.viewLabel() != 0);
       
   397 
       
   398         const QString headingLabel("abcd");
       
   399 
       
   400         QScopedPointer<HbAction> backSteppingAction(new HbAction(Hb::BackNaviAction));
       
   401         backSteppingAction->setObjectName("backSteppingAction");
       
   402 
       
   403         menuView.viewLabel()->setHeading(headingLabel);
       
   404         menuView.view()->setNavigationAction(backSteppingAction.data());
       
   405 
       
   406         menuView.reset(HsEmptyLabelContext);
       
   407 
       
   408         QCOMPARE(menuView.mBuilder.mStateContext, HsCollectionContext);
       
   409         QCOMPARE(menuView.mBuilder.mOperationalContext, HsEmptyLabelContext);
       
   410 
       
   411         QCOMPARE(menuView.view()->navigationAction()->objectName(),
       
   412                  backSteppingAction->objectName());
       
   413 
       
   414         QVERIFY(menuView.viewLabel());
       
   415         QCOMPARE(menuView.viewLabel()->heading(), headingLabel);
       
   416     }
       
   417 #ifdef Q_OS_SYMBIAN
       
   418 #ifdef UT_MEMORY_CHECK
       
   419     __UHEAP_MARKEND;
       
   420 #endif//UT_MEMORY_CHECK
       
   421 #endif//Q_OS_SYMBIAN
       
   422 }
       
   423 
       
   424 // ---------------------------------------------------------------------------
       
   425 // ---------------------------------------------------------------------------
       
   426 //
       
   427 void MenuStatesTest::testslot_activated(const QModelIndex &aIndex)
       
   428 {
       
   429     mIndex = aIndex;
       
   430 }
       
   431 // ---------------------------------------------------------------------------
       
   432 // ---------------------------------------------------------------------------
       
   433 //
       
   434 void MenuStatesTest::testslot_longpressed(HbAbstractViewItem *item,
       
   435         const QPointF &coords)
       
   436 {
       
   437     mPoint = coords;
       
   438     mItem = item;
       
   439 }
       
   440 
       
   441 // ---------------------------------------------------------------------------
       
   442 // ---------------------------------------------------------------------------
       
   443 //
       
   444 void MenuStatesTest::HsListViewItem_updateChildItems()
       
   445 {
       
   446 #ifdef Q_OS_SYMBIAN
       
   447     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   448 #ifdef UT_MEMORY_CHECK
       
   449     __UHEAP_MARK;
       
   450 #endif//UT_MEMORY_CHECK
       
   451 #endif//Q_OS_SYMBIAN
       
   452     {
       
   453         HsMenuViewBuilder builder;
       
   454         HsMenuModeWrapper menuMode;
       
   455         HsMainWindowMock mainWindow;
       
   456         QScopedPointer<HsAllAppsState> allAppsState(new HsAllAppsState(
       
   457             builder, menuMode, mainWindow, 0));
       
   458 
       
   459 	    HsMenuItemModel *model = allAppsState->mModel;
       
   460 
       
   461         QVERIFY(model != static_cast<HsMenuItemModel *>(0));
       
   462         QVERIFY(model->rowCount() > 0);
       
   463         QModelIndex itemModelIndex = model->index(0, 0);
       
   464 
       
   465         QScopedPointer<HsListViewItem> listViewItem(new HsListViewItem);
       
   466 
       
   467         listViewItem->setModelIndex(itemModelIndex);
       
   468 
       
   469 
       
   470         QCOMPARE((int)listViewItem->progress,0);
       
   471         QCOMPARE(listViewItem->isProgress,false);
       
   472         listViewItem->updateChildItems();
       
   473         QCOMPARE((int)listViewItem->progress,0);
       
   474         QCOMPARE(listViewItem->isProgress,false);
       
   475     }
       
   476 #ifdef Q_OS_SYMBIAN
       
   477 #ifdef UT_MEMORY_CHECK
       
   478     __UHEAP_MARKEND;
       
   479 #endif//UT_MEMORY_CHECK
       
   480 #endif//Q_OS_SYMBIAN
       
   481 }
       
   482 // ---------------------------------------------------------------------------
       
   483 // ---------------------------------------------------------------------------
       
   484 //
       
   485 void MenuStatesTest::HsListViewItem_createItem()
       
   486 {
       
   487 #ifdef Q_OS_SYMBIAN
       
   488     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   489 #ifdef UT_MEMORY_CHECK
       
   490     __UHEAP_MARK;
       
   491 #endif//UT_MEMORY_CHECK
       
   492 #endif//Q_OS_SYMBIAN
       
   493     {
       
   494         QScopedPointer<HsListViewItem> listViewItem(new HsListViewItem);
       
   495 
       
   496         QCOMPARE((HbAbstractViewItem*)listViewItem.data() ,listViewItem->prototype() );
       
   497         QScopedPointer<HbAbstractViewItem> newItem( listViewItem->createItem() );
       
   498 
       
   499         QCOMPARE(newItem->prototype(), (HbAbstractViewItem*)listViewItem.data() );
       
   500     }
       
   501 #ifdef Q_OS_SYMBIAN
       
   502 #ifdef UT_MEMORY_CHECK
       
   503     __UHEAP_MARKEND;
       
   504 #endif//UT_MEMORY_CHECK
       
   505 #endif//Q_OS_SYMBIAN
       
   506 }
       
   507 // ---------------------------------------------------------------------------
       
   508 // ---------------------------------------------------------------------------
       
   509 //
       
   510 void MenuStatesTest::HsListViewItem_polish()
       
   511 {
       
   512 #ifdef Q_OS_SYMBIAN
       
   513     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   514 #ifdef UT_MEMORY_CHECK
       
   515     __UHEAP_MARK;
       
   516 #endif//UT_MEMORY_CHECK
       
   517 #endif//Q_OS_SYMBIAN
       
   518     {
       
   519         QScopedPointer<HsListViewItem> listViewItem(new HsListViewItem);
       
   520         HbStyleParameters styleParam;
       
   521 
       
   522         bool expectedVal = false;
       
   523         listViewItem->isProgress = expectedVal;
       
   524         listViewItem->polish(styleParam);
       
   525         QVariant property = listViewItem->property("progress");
       
   526         bool val = property.value<bool>();
       
   527 
       
   528         QCOMPARE(val, expectedVal);
       
   529 
       
   530         expectedVal = true;
       
   531         listViewItem->isProgress = expectedVal;
       
   532         listViewItem->polish(styleParam);
       
   533         property = listViewItem->property("progress");
       
   534         val = property.value<bool>();
       
   535 
       
   536         QCOMPARE(val, expectedVal);
       
   537     }
       
   538 #ifdef Q_OS_SYMBIAN
       
   539 #ifdef UT_MEMORY_CHECK
       
   540     __UHEAP_MARKEND;
       
   541 #endif//UT_MEMORY_CHECK
       
   542 #endif//Q_OS_SYMBIAN
       
   543 }
       
   544 
       
   545 // ---------------------------------------------------------------------------
       
   546 // ---------------------------------------------------------------------------
       
   547 //
       
   548 void MenuStatesTest::HsProgressBar_timerEvent()
       
   549 {
       
   550 #ifdef Q_OS_SYMBIAN
       
   551     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   552 #ifdef UT_MEMORY_CHECK
       
   553     __UHEAP_MARK;
       
   554 #endif//UT_MEMORY_CHECK
       
   555 #endif//Q_OS_SYMBIAN
       
   556     {
       
   557         HsProgressBar bar;
       
   558         QTimerEvent event(0);
       
   559         bar.timerEvent(&event);
       
   560         QCOMPARE(bar.mTimerId, 0);
       
   561         int val = bar.progressValue();
       
   562         bar.mTargetValue = 1;
       
   563         bar.timerEvent(&event);
       
   564         QCOMPARE(bar.progressValue(), val + 1);
       
   565     }
       
   566 #ifdef Q_OS_SYMBIAN
       
   567 #ifdef UT_MEMORY_CHECK
       
   568     __UHEAP_MARKEND;
       
   569 #endif//UT_MEMORY_CHECK
       
   570 #endif//Q_OS_SYMBIAN
       
   571 }
       
   572 
       
   573 // ---------------------------------------------------------------------------
       
   574 // ---------------------------------------------------------------------------
       
   575 //
       
   576 void MenuStatesTest::HsProgressBar_setTargetProgressValue()
       
   577 {
       
   578 #ifdef Q_OS_SYMBIAN
       
   579     User::ResetInactivityTime();//it should help for Viewserver11 panic
       
   580 #ifdef UT_MEMORY_CHECK
       
   581     __UHEAP_MARK;
       
   582 #endif//UT_MEMORY_CHECK
       
   583 #endif//Q_OS_SYMBIAN
       
   584     {
       
   585         HsProgressBar bar;
       
   586         bar.setTargetProgressValue(0);
       
   587         QCOMPARE(bar.mTargetValue, 0);
       
   588         bar.setTargetProgressValue(1);
       
   589         QCOMPARE(bar.mTargetValue, 1);
       
   590         QVERIFY(bar.mTimerId);
       
   591     }
       
   592 #ifdef Q_OS_SYMBIAN
       
   593 #ifdef UT_MEMORY_CHECK
       
   594     __UHEAP_MARKEND;
       
   595 #endif//UT_MEMORY_CHECK
       
   596 #endif//Q_OS_SYMBIAN
       
   597 }
       
   598 
       
   599 void MenuStatesTest::MenuView_showHideSearchPanel()
       
   600 {
       
   601     HsMenuViewBuilder builder;
       
   602     HsMainWindowSpy window;
       
   603     HsMenuView menuView(builder, HsAllAppsContext, window);
       
   604 
       
   605     menuView.showSearchPanel();
       
   606     HbView *originatingView = menuView.view();
       
   607     QVERIFY(window.mSwitchedToView != originatingView);
       
   608     menuView.hideSearchPanel();
       
   609     QVERIFY(window.mSwitchedToView == originatingView);
       
   610 
       
   611 }
       
   612 
       
   613 
       
   614 QTEST_MAIN(MenuStatesTest)