homescreenapp/stateplugins/hsapplibrarystateplugin/tsrc/t_applibrarystate/src/t_applibrarystate.cpp
changeset 97 66b5fe3c07fd
parent 90 3ac3aaebaee5
child 98 e6f74eb7f69f
equal deleted inserted replaced
95:32e56106abf2 97:66b5fe3c07fd
    35 #include "hsallappsstate.h"
    35 #include "hsallappsstate.h"
    36 #include "hsinstalledappsstate.h"
    36 #include "hsinstalledappsstate.h"
    37 #include "hsoperatorhandler_p.h"
    37 #include "hsoperatorhandler_p.h"
    38 #include "hsoperatorhandler.h"
    38 #include "hsoperatorhandler.h"
    39 #include "hsmenuservice.h"
    39 #include "hsmenuservice.h"
       
    40 #include "hsscene.h"
    40 
    41 
    41 #include "t_hsaddtohomescreenmockstate.h"
    42 #include "t_hsaddtohomescreenmockstate.h"
    42 #include "t_hsmockmodel.h"
    43 #include "t_hsmockmodel.h"
    43 #include "t_applibrarystate.h"
    44 #include "t_applibrarystate.h"
    44 
    45 
    50 const int IncludeOperatorStore      = 0x00000001;
    51 const int IncludeOperatorStore      = 0x00000001;
    51 const int RemoveOviStore            = 0x00000008;
    52 const int RemoveOviStore            = 0x00000008;
    52 //const char *operatorStoreIconPath
    53 //const char *operatorStoreIconPath
    53 //        = "z:/private/20022F35/customsvg/operatorstore.svg";
    54 //        = "z:/private/20022F35/customsvg/operatorstore.svg";
    54 
    55 
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 // ---------------------------------------------------------------------------
       
    60 //
    55 void MenuStatesTest::OperatorHandler_storesPresent()
    61 void MenuStatesTest::OperatorHandler_storesPresent()
    56 {
    62 {
    57     HsOperatorHandler oviHandler;
    63     HsOperatorHandler oviHandler;
    58     XQSettingsManager man;
    64     XQSettingsManager man;
    59 
    65 
    65     oviHandler.m_q->mOviStorePresent = value1;
    71     oviHandler.m_q->mOviStorePresent = value1;
    66     QCOMPARE(oviHandler.oviStorePresent(), value1);
    72     QCOMPARE(oviHandler.oviStorePresent(), value1);
    67 
    73 
    68 }
    74 }
    69 
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 // ---------------------------------------------------------------------------
       
    79 //
    70 void MenuStatesTest::OperatorHandler_first()
    80 void MenuStatesTest::OperatorHandler_first()
    71 {
    81 {
    72     HsOperatorHandler oviHandler;
    82     HsOperatorHandler oviHandler;
    73     XQSettingsManager man;
    83     XQSettingsManager man;
    74 
    84 
    75     bool value = oviHandler.m_q->operatorStoreFirst(&man);
    85     bool value = oviHandler.m_q->operatorStoreFirst(&man);
    76     oviHandler.m_q->mOperatorStoreFirst = value;
    86     oviHandler.m_q->mOperatorStoreFirst = value;
    77     QCOMPARE(oviHandler.operatorStoreFirst(), value);
    87     QCOMPARE(oviHandler.operatorStoreFirst(), value);
    78 }
    88 }
    79 
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 // ---------------------------------------------------------------------------
       
    93 //
    80 void MenuStatesTest::OperatorHandler_type()
    94 void MenuStatesTest::OperatorHandler_type()
    81 {
    95 {
    82     HsOperatorHandler oviHandler;
    96     HsOperatorHandler oviHandler;
    83     XQSettingsManager man;
    97     XQSettingsManager man;
    84 
    98 
    87     QVERIFY(value == HsOperatorHandlerPrivate::ApplicationType
   101     QVERIFY(value == HsOperatorHandlerPrivate::ApplicationType
    88             || value == HsOperatorHandlerPrivate::UrlType
   102             || value == HsOperatorHandlerPrivate::UrlType
    89             || value == HsOperatorHandlerPrivate::NoneType);
   103             || value == HsOperatorHandlerPrivate::NoneType);
    90 }
   104 }
    91 
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 // ---------------------------------------------------------------------------
       
   109 //
    92 void MenuStatesTest::OperatorHandler_createAction()
   110 void MenuStatesTest::OperatorHandler_createAction()
    93 {
   111 {
    94     HsOperatorHandler oviHandler;
   112     HsOperatorHandler oviHandler;
    95     oviHandler.m_q->mIcon = HbIcon();
   113     oviHandler.m_q->mIcon = HbIcon();
    96     HbAction *action = oviHandler.prepareOperatorStoreAction(new HbAction);
   114     HbAction *action = oviHandler.prepareOperatorStoreAction(new HbAction);
   100 #endif//QT_EXTENSIONS
   118 #endif//QT_EXTENSIONS
   101 
   119 
   102 
   120 
   103 
   121 
   104 
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 // ---------------------------------------------------------------------------
       
   126 //
   105 class HsMainWindowMock : public HsMainWindow
   127 class HsMainWindowMock : public HsMainWindow
   106 {
   128 {
   107     virtual void setCurrentView(HbView *view);
   129     virtual void setCurrentView(HbView *view);
   108 
   130 
   109 };
   131 };
   110 
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 // ---------------------------------------------------------------------------
       
   136 //
   111 void HsMainWindowMock::setCurrentView(HbView *view)
   137 void HsMainWindowMock::setCurrentView(HbView *view)
   112 {
   138 {
   113     Q_UNUSED(view);
   139     Q_UNUSED(view);
   114     // do nothing
   140     // do nothing
   115 }
   141 }
   116 
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 // ---------------------------------------------------------------------------
       
   146 //
   117 void MenuStatesTest::cleanup()
   147 void MenuStatesTest::cleanup()
   118 {
   148 {
   119     qApp->processEvents();
   149     qApp->processEvents();
   120 }
   150 }
   121 
   151 
   122 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------
       
   153 //
   123 // ---------------------------------------------------------------------------
   154 // ---------------------------------------------------------------------------
   124 //
   155 //
   125 void MenuStatesTest::ApplicationLibraryState_construction()
   156 void MenuStatesTest::ApplicationLibraryState_construction()
   126 {
   157 {
   127 #ifdef Q_OS_SYMBIAN
   158 #ifdef Q_OS_SYMBIAN
   146 #endif//UT_MEMORY_CHECK
   177 #endif//UT_MEMORY_CHECK
   147 #endif//Q_OS_SYMBIAN
   178 #endif//Q_OS_SYMBIAN
   148 }
   179 }
   149 
   180 
   150 // ---------------------------------------------------------------------------
   181 // ---------------------------------------------------------------------------
       
   182 //
   151 // ---------------------------------------------------------------------------
   183 // ---------------------------------------------------------------------------
   152 //
   184 //
   153 void MenuStatesTest::ApplicationLibraryState_historySlots()
   185 void MenuStatesTest::ApplicationLibraryState_historySlots()
   154 {
   186 {
   155 #ifdef Q_OS_SYMBIAN
   187 #ifdef Q_OS_SYMBIAN
   192     __UHEAP_MARKEND;
   224     __UHEAP_MARKEND;
   193 #endif//UT_MEMORY_CHECK
   225 #endif//UT_MEMORY_CHECK
   194 #endif//Q_OS_SYMBIAN
   226 #endif//Q_OS_SYMBIAN
   195 }
   227 }
   196 
   228 
   197 
   229 // ---------------------------------------------------------------------------
   198 // ---------------------------------------------------------------------------
   230 //
   199 // ---------------------------------------------------------------------------
   231 // ---------------------------------------------------------------------------
   200 //
   232 //
   201 void MenuStatesTest::ApplicationLibraryState_backSteppingAction()
   233 void MenuStatesTest::ApplicationLibraryState_backSteppingAction()
   202 {
   234 {
   203 #ifdef Q_OS_SYMBIAN
   235 #ifdef Q_OS_SYMBIAN
   205 #ifdef UT_MEMORY_CHECK
   237 #ifdef UT_MEMORY_CHECK
   206     __UHEAP_MARK;
   238     __UHEAP_MARK;
   207 #endif//UT_MEMORY_CHECK
   239 #endif//UT_MEMORY_CHECK
   208 #endif//Q_OS_SYMBIAN
   240 #endif//Q_OS_SYMBIAN
   209     {
   241     {
       
   242 
       
   243         QFAIL("! Due to bug in hb wk36 we are forced to skip this test !");
       
   244         
   210         QScopedPointer<HbMainWindow> wind(new HbMainWindow);
   245         QScopedPointer<HbMainWindow> wind(new HbMainWindow);
       
   246         HsScene::setInstance( new HsScene(wind.data()) );
   211         //create statemachine to perform transitions
   247         //create statemachine to perform transitions
   212         QScopedPointer<QStateMachine> machine(new QStateMachine(0));
   248         QScopedPointer<QStateMachine> machine(new QStateMachine(0));
   213 
   249 
   214         HsAppLibraryState *appLibrary = new HsAppLibraryState(machine.data());
   250         HsAppLibraryState *appLibrary = new HsAppLibraryState(machine.data());
   215 
   251 
   236 #endif//UT_MEMORY_CHECK
   272 #endif//UT_MEMORY_CHECK
   237 #endif//Q_OS_SYMBIAN
   273 #endif//Q_OS_SYMBIAN
   238 }
   274 }
   239 
   275 
   240 // ---------------------------------------------------------------------------
   276 // ---------------------------------------------------------------------------
       
   277 //
   241 // ---------------------------------------------------------------------------
   278 // ---------------------------------------------------------------------------
   242 //
   279 //
   243 void MenuStatesTest::ApplicationLibraryState_clearToolbarLatch()
   280 void MenuStatesTest::ApplicationLibraryState_clearToolbarLatch()
   244 {
   281 {
   245 #ifdef Q_OS_SYMBIAN
   282 #ifdef Q_OS_SYMBIAN
   261 #endif//UT_MEMORY_CHECK
   298 #endif//UT_MEMORY_CHECK
   262 #endif//Q_OS_SYMBIAN
   299 #endif//Q_OS_SYMBIAN
   263 }
   300 }
   264 
   301 
   265 // ---------------------------------------------------------------------------
   302 // ---------------------------------------------------------------------------
       
   303 //
   266 // ---------------------------------------------------------------------------
   304 // ---------------------------------------------------------------------------
   267 //
   305 //
   268 #ifdef QT_EXTENSIONS
   306 #ifdef QT_EXTENSIONS
   269 void MenuStatesTest::ApplicationLibraryState_oviStoreAction()
   307 void MenuStatesTest::ApplicationLibraryState_oviStoreAction()
   270 {
   308 {
   280     __UHEAP_MARKEND;
   318     __UHEAP_MARKEND;
   281 #endif//UT_MEMORY_CHECK
   319 #endif//UT_MEMORY_CHECK
   282 }
   320 }
   283 
   321 
   284 // ---------------------------------------------------------------------------
   322 // ---------------------------------------------------------------------------
       
   323 //
   285 // ---------------------------------------------------------------------------
   324 // ---------------------------------------------------------------------------
   286 //
   325 //
   287 void MenuStatesTest::OperatorHandler_icon()
   326 void MenuStatesTest::OperatorHandler_icon()
   288 {
   327 {
   289     User::ResetInactivityTime();//it should help for Viewserver11 panic
   328     User::ResetInactivityTime();//it should help for Viewserver11 panic
   301     __UHEAP_MARKEND;
   340     __UHEAP_MARKEND;
   302 #endif//UT_MEMORY_CHECK
   341 #endif//UT_MEMORY_CHECK
   303 }
   342 }
   304 
   343 
   305 // ---------------------------------------------------------------------------
   344 // ---------------------------------------------------------------------------
       
   345 //
   306 // ---------------------------------------------------------------------------
   346 // ---------------------------------------------------------------------------
   307 //
   347 //
   308 void MenuStatesTest::OperatorHandler_text()
   348 void MenuStatesTest::OperatorHandler_text()
   309 {
   349 {
   310     User::ResetInactivityTime();//it should help for Viewserver11 panic
   350     User::ResetInactivityTime();//it should help for Viewserver11 panic
   323     __UHEAP_MARKEND;
   363     __UHEAP_MARKEND;
   324 #endif//UT_MEMORY_CHECK
   364 #endif//UT_MEMORY_CHECK
   325 }
   365 }
   326 
   366 
   327 // ---------------------------------------------------------------------------
   367 // ---------------------------------------------------------------------------
       
   368 //
   328 // ---------------------------------------------------------------------------
   369 // ---------------------------------------------------------------------------
   329 //
   370 //
   330 void MenuStatesTest::OperatorHandler_action()
   371 void MenuStatesTest::OperatorHandler_action()
   331 {
   372 {
   332     User::ResetInactivityTime();//it should help for Viewserver11 panic
   373     User::ResetInactivityTime();//it should help for Viewserver11 panic
   346     __UHEAP_MARKEND;
   387     __UHEAP_MARKEND;
   347 #endif//UT_MEMORY_CHECK
   388 #endif//UT_MEMORY_CHECK
   348 }
   389 }
   349 
   390 
   350 // ---------------------------------------------------------------------------
   391 // ---------------------------------------------------------------------------
       
   392 //
   351 // ---------------------------------------------------------------------------
   393 // ---------------------------------------------------------------------------
   352 //
   394 //
   353 void MenuStatesTest::OperatorHandler_entry()
   395 void MenuStatesTest::OperatorHandler_entry()
   354 {
   396 {
   355     User::ResetInactivityTime();//it should help for Viewserver11 panic
   397     User::ResetInactivityTime();//it should help for Viewserver11 panic
   378     __UHEAP_MARKEND;
   420     __UHEAP_MARKEND;
   379 #endif//UT_MEMORY_CHECK
   421 #endif//UT_MEMORY_CHECK
   380 }
   422 }
   381 
   423 
   382 // ---------------------------------------------------------------------------
   424 // ---------------------------------------------------------------------------
       
   425 //
   383 // ---------------------------------------------------------------------------
   426 // ---------------------------------------------------------------------------
   384 //
   427 //
   385 void MenuStatesTest::OperatorHandler_noCrWriteAccess()
   428 void MenuStatesTest::OperatorHandler_noCrWriteAccess()
   386 {
   429 {
   387     User::ResetInactivityTime();//it should help for Viewserver11 panic
   430     User::ResetInactivityTime();//it should help for Viewserver11 panic
   401     __UHEAP_MARKEND;
   444     __UHEAP_MARKEND;
   402 #endif//UT_MEMORY_CHECK
   445 #endif//UT_MEMORY_CHECK
   403 }
   446 }
   404 #endif//QT_EXTENSIONS
   447 #endif//QT_EXTENSIONS
   405 
   448 
   406 
   449 // ---------------------------------------------------------------------------
   407 // ---------------------------------------------------------------------------
   450 //
   408 // ---------------------------------------------------------------------------
   451 // ---------------------------------------------------------------------------
   409 //
   452 //
   410 void MenuStatesTest::HsBaseViewState_createApplicationLaunchFailMessage()
   453 void MenuStatesTest::HsBaseViewState_createApplicationLaunchFailMessage()
   411 {
   454 {
   412 #ifdef Q_OS_SYMBIAN
   455 #ifdef Q_OS_SYMBIAN