void HomeScreenStatePluginTest::testLoadBackupRestoreStateOnEntryExit()
{
    HbInstance::instance();
    HbMainWindow mainWindow;
    mainWindow.show();   
    QCoreApplication::sendPostedEvents();
   
    QStateMachine *sm = new QStateMachine;
    HsBackupRestoreState *brs = new HsBackupRestoreState;

    sm->addState(brs);
    sm->setInitialState(brs);    
    

    QFinalState *fs = new QFinalState;
    sm->addState(fs);

    brs->addTransition(this, SIGNAL(finishStateMachine()), fs);

    sm->start();   
    QCoreApplication::sendPostedEvents();  
    emit finishStateMachine();

    sm->stop();
    // main window deleted -> HsGui must be deleted also
    delete HsGui::takeInstance();
    delete sm;
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
void MenuStatesTest::createArrangeCollection()
{
#ifdef Q_OS_SYMBIAN
    User::ResetInactivityTime();//it should help for Viewserver11 panic
#ifdef UT_MEMORY_CHECK
    __UHEAP_MARK;
#endif//UT_MEMORY_CHECK
#endif//Q_OS_SYMBIAN
    {
        HsMenuViewBuilder builder;
        HsMenuModeWrapper menuMode;
        HsMainWindowMock mainWindow;
        QStateMachine *machine = new QStateMachine(0);

        const QString collectionName("testCollection" +
                                     QDateTime::currentDateTime().
                                     toString("ddmmyyyy_hh_mm_ss_zzz"));
        const int collectionId = HsMenuService::createCollection(collectionName);

        HsCollectionState *collectionState =
            new HsCollectionState(builder, menuMode, mainWindow, machine);

        collectionState->mCollectionId = collectionId;

        machine->setInitialState(collectionState);

        AddToHomeScreenMockState *mockState = new AddToHomeScreenMockState(machine);

        // create a transition to the new child state which will be triggered by
        // an event with specified operation type
        HsMenuEventTransition *transition = new HsMenuEventTransition(
            HsMenuEvent::ArrangeCollection, collectionState, mockState);
        collectionState->addTransition(transition);

        machine->start();
        qApp->sendPostedEvents();
        collectionState->createArrangeCollection();
        qApp->sendPostedEvents();

        QVERIFY(mockState->enteredValue());
        qApp->removePostedEvents(0);
        machine->stop();

        delete machine;
    }
#ifdef Q_OS_SYMBIAN
#ifdef UT_MEMORY_CHECK
    __UHEAP_MARKEND;
#endif//UT_MEMORY_CHECK
#endif//Q_OS_SYMBIAN
}