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

/*
* Copyright (c) 2009 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>
#ifdef Q_OS_SYMBIAN
#include <XQSettingsManager>
#include <startupdomainpskeys.h>
#endif
#include <HbInstance>
#include <HbMainWindow>

#include "t_hshomescreenstateplugin.h"
#include "hsloadscenestate.h"
#include "hsscene.h"
#include "hsgui.h"

void HomeScreenStatePluginTest::testLoadSceneStateConstructors()
{
    HsLoadSceneState *lss = new HsLoadSceneState;
    delete lss;
}

void HomeScreenStatePluginTest::testLoadSceneStateOnEntryExit()
{
    HbInstance::instance();
    HbMainWindow mainWindow;
   
    HsLoadSceneState *lss = new HsLoadSceneState;

    QStateMachine *sm = new QStateMachine;
    sm->addState(lss);
    sm->setInitialState(lss);
    sm->start();
 
    QCoreApplication::sendPostedEvents(sm,0);
    // main window deleted -> HsGui must be deleted also
    delete HsGui::takeInstance();
    delete sm;
  
}

#ifdef Q_OS_SYMBIAN
void HomeScreenStatePluginTest::testLoadSceneStateHandleKeyChange()
{
    HbInstance::instance();
    HbMainWindow mainWindow;
  //  mainWindow.show();
   // QCoreApplication::sendPostedEvents();
    
    HsLoadSceneState *lss = new HsLoadSceneState;
    XQSettingsKey testKey(XQSettingsKey::TargetPublishAndSubscribe, KPSUidStartup.iUid, KPSStartupUiPhase);
    QVariant variant(QVariant::Int);
    lss->handleKeyChange(testKey, variant);
    int value = EStartupUiPhaseAllDone;
    variant.setValue(value);
    lss->handleKeyChange(testKey, variant);

    // main window deleted -> HsGui must be deleted also
    delete HsGui::takeInstance();
    delete lss;
}
#endif