homescreenapp/stateplugins/hshomescreenstateplugin/tsrc/t_hshomescreenstateplugin/src/t_hsloadscenestate.cpp
changeset 90 3ac3aaebaee5
child 101 ba1b7e218624
equal deleted inserted replaced
86:e4f038c420f7 90:3ac3aaebaee5
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QStateMachine>
       
    19 #ifdef Q_OS_SYMBIAN
       
    20 #include <XQSettingsManager>
       
    21 #include <startupdomainpskeys.h>
       
    22 #endif
       
    23 #include <HbInstance>
       
    24 #include <HbMainWindow>
       
    25 
       
    26 #include "t_hshomescreenstateplugin.h"
       
    27 #include "hsloadscenestate.h"
       
    28 #include "hsscene.h"
       
    29 #include "hsgui.h"
       
    30 
       
    31 void HomeScreenStatePluginTest::testLoadSceneStateConstructors()
       
    32 {
       
    33     HsLoadSceneState *lss = new HsLoadSceneState;
       
    34     delete lss;
       
    35 }
       
    36 
       
    37 void HomeScreenStatePluginTest::testLoadSceneStateOnEntryExit()
       
    38 {
       
    39     HbInstance::instance();
       
    40     HbMainWindow mainWindow;
       
    41     mainWindow.show();
       
    42 
       
    43     HsLoadSceneState *lss = new HsLoadSceneState;
       
    44 
       
    45     QStateMachine *sm = new QStateMachine;
       
    46     sm->addState(lss);
       
    47     sm->setInitialState(lss);
       
    48     sm->start();
       
    49     QCoreApplication::sendPostedEvents();
       
    50     // main window deleted -> HsGui must be deleted also
       
    51     delete HsGui::takeInstance();
       
    52     delete sm;
       
    53 }
       
    54 
       
    55 #ifdef Q_OS_SYMBIAN
       
    56 void HomeScreenStatePluginTest::testLoadSceneStateHandleKeyChange()
       
    57 {
       
    58     HbInstance::instance();
       
    59     HbMainWindow mainWindow;
       
    60     mainWindow.show();
       
    61     QCoreApplication::sendPostedEvents();
       
    62     
       
    63     HsLoadSceneState *lss = new HsLoadSceneState;
       
    64     XQSettingsKey testKey(XQSettingsKey::TargetPublishAndSubscribe, KPSUidStartup.iUid, KPSStartupUiPhase);
       
    65     QVariant variant(QVariant::Int);
       
    66     lss->handleKeyChange(testKey, variant);
       
    67     int value = EStartupUiPhaseAllDone;
       
    68     variant.setValue(value);
       
    69     lss->handleKeyChange(testKey, variant);
       
    70 
       
    71     // main window deleted -> HsGui must be deleted also
       
    72     delete HsGui::takeInstance();
       
    73     delete lss;
       
    74 }
       
    75 #endif