homescreenapp/stateplugins/hshomescreenstateplugin/tsrc/t_hshomescreenstateplugin/src/t_hsbackuprestorestate.cpp
author hgs
Wed, 20 Oct 2010 15:25:39 +0300
changeset 101 ba1b7e218624
parent 90 3ac3aaebaee5
permissions -rw-r--r--
201042

/*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/

#include <QStateMachine>

#include <HbInstance>
#include <HbMainWindow>

#include "t_hshomescreenstateplugin.h"
#include "hsbackuprestorestate.h"
#include "hsscene.h"
#include "hsdatabase.h"
#include "hsgui.h"

void HomeScreenStatePluginTest::testLoadBackupRestoreStateConstructors()
{
    HsBackupRestoreState *brs = new HsBackupRestoreState;
    delete brs;
}

void HomeScreenStatePluginTest::testLoadBackupRestoreStateOnEntryExit()
{
    HbInstance::instance();
    HbMainWindow mainWindow;
   // mainWindow.show();   
   
    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(sm,0);  
    emit finishStateMachine();

    sm->stop();
    // main window deleted -> HsGui must be deleted also
    delete HsGui::takeInstance();
    delete sm;
}