homescreenapp/stateplugins/hsmenuworkerstateplugin/tsrc/t_hsmenuworkerstateplugin/src/t_hsmenustates.cpp
changeset 97 66b5fe3c07fd
parent 90 3ac3aaebaee5
equal deleted inserted replaced
95:32e56106abf2 97:66b5fe3c07fd
    25 
    25 
    26 #include "hsaddtohomescreenstate.h"
    26 #include "hsaddtohomescreenstate.h"
    27 #include "hsshortcutservice.h"
    27 #include "hsshortcutservice.h"
    28 #include "hsdialogcontroller.h"
    28 #include "hsdialogcontroller.h"
    29 
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 // ---------------------------------------------------------------------------
       
    33 //
    30 void MenuStatesTest::initTestCase()
    34 void MenuStatesTest::initTestCase()
    31 {
    35 {
    32 #ifdef Q_OS_SYMBIAN
    36 #ifdef Q_OS_SYMBIAN
    33     startThread();
    37     startThread();
    34     QDir::setCurrent("C:/");
    38     QDir::setCurrent("C:/");
    36     mStateMachine = new QStateMachine;
    40     mStateMachine = new QStateMachine;
    37     mShortcutService = QSharedPointer<HsShortcutService>
    41     mShortcutService = QSharedPointer<HsShortcutService>
    38                        (HsShortcutService::instance(mStateMachine/*,0*/));
    42                        (HsShortcutService::instance(mStateMachine/*,0*/));
    39     mWindow = new HbMainWindow();
    43     mWindow = new HbMainWindow();
    40 }
    44 }
       
    45 
    41 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
       
    47 //
    42 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    43 //
    49 //
    44 void MenuStatesTest::cleanupTestCase()
    50 void MenuStatesTest::cleanupTestCase()
    45 {
    51 {
    46 #ifdef Q_OS_SYMBIAN
    52 #ifdef Q_OS_SYMBIAN
    47     stopThread();
    53     stopThread();
    48 #endif //Q_OS_SYMBIAN
    54 #endif //Q_OS_SYMBIAN
    49     delete mStateMachine;
    55     delete mStateMachine;
    50     delete mWindow;
    56     //QWARN ( "Due to bug in hb wk36 we are we have to avoid deleting "
    51     mWindow = NULL;
    57     //        "HbMainWindow, remove comment when fixed" )    
       
    58 /*    delete mWindow;
       
    59     mWindow = NULL;*/
    52 }
    60 }
    53 
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 // ---------------------------------------------------------------------------
       
    65 //
    54 void MenuStatesTest::cleanup()
    66 void MenuStatesTest::cleanup()
    55 {
    67 {
    56     qApp->processEvents();
    68     qApp->processEvents();
    57 }
    69 }
    58 
    70 
    59 
       
    60 // ---------------------------------------------------------------------------
    71 // ---------------------------------------------------------------------------
       
    72 //
    61 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
       
    74 //
    62 int threadFunction(void *params)
    75 int threadFunction(void *params)
    63 {
    76 {
    64     Q_UNUSED(params);
    77     Q_UNUSED(params);
    65 #ifdef Q_OS_SYMBIAN
    78 #ifdef Q_OS_SYMBIAN
    66     while (ETrue) {
    79     while (ETrue) {
    70 #endif //Q_OS_SYMBIAN
    83 #endif //Q_OS_SYMBIAN
    71     return 0;
    84     return 0;
    72 }
    85 }
    73 
    86 
    74 // ---------------------------------------------------------------------------
    87 // ---------------------------------------------------------------------------
       
    88 //
    75 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    76 //
    90 //
    77 void MenuStatesTest::startThread()
    91 void MenuStatesTest::startThread()
    78 {
    92 {
    79 #ifdef Q_OS_SYMBIAN
    93 #ifdef Q_OS_SYMBIAN
    85                            4000,
    99                            4000,
    86                            NULL));
   100                            NULL));
    87     iThread.Resume();
   101     iThread.Resume();
    88 #endif //Q_OS_SYMBIAN
   102 #endif //Q_OS_SYMBIAN
    89 }
   103 }
       
   104 
    90 // ---------------------------------------------------------------------------
   105 // ---------------------------------------------------------------------------
       
   106 //
    91 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
    92 //
   108 //
    93 void MenuStatesTest::stopThread()
   109 void MenuStatesTest::stopThread()
    94 {
   110 {
    95 #ifdef Q_OS_SYMBIAN
   111 #ifdef Q_OS_SYMBIAN
    97     QTest::qWait(3000);
   113     QTest::qWait(3000);
    98 #endif //Q_OS_SYMBIAN
   114 #endif //Q_OS_SYMBIAN
    99 }
   115 }
   100 
   116 
   101 // ---------------------------------------------------------------------------
   117 // ---------------------------------------------------------------------------
       
   118 //
   102 // ---------------------------------------------------------------------------
   119 // ---------------------------------------------------------------------------
   103 //
   120 //
   104 void MenuStatesTest::testSlot(HbAction* finished)
   121 void MenuStatesTest::testSlot(HbAction* finished)
   105 {
   122 {
   106     Q_UNUSED(finished)
   123     Q_UNUSED(finished)
   107     mFinishedEmited = true;
   124     mFinishedEmited = true;
   108 }
   125 }
   109 
   126 
   110 // ---------------------------------------------------------------------------
   127 // ---------------------------------------------------------------------------
       
   128 //
   111 // ---------------------------------------------------------------------------
   129 // ---------------------------------------------------------------------------
   112 //
   130 //
   113 int MenuStatesTest::testExitSlot()
   131 int MenuStatesTest::testExitSlot()
   114 {
   132 {
   115     mFinishedEmited = true;
   133     mFinishedEmited = true;
   116     return 0;
   134     return 0;
   117 }
   135 }
   118 
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 // ---------------------------------------------------------------------------
       
   140 //
   119 void MenuStatesTest::checkDialogController()
   141 void MenuStatesTest::checkDialogController()
   120 {
   142 {
   121 
   143 
   122     QGraphicsScene *scene = mWindow->scene();
   144     QGraphicsScene *scene = mWindow->scene();
   123     QGraphicsItem *focusItem = scene->focusItem();
   145     QGraphicsItem *focusItem = scene->focusItem();