31 #include "hsmenumodewrapper.h" |
31 #include "hsmenumodewrapper.h" |
32 #include "hsmenuevent.h" |
32 #include "hsmenuevent.h" |
33 #include "hsallcollectionsstate.h" |
33 #include "hsallcollectionsstate.h" |
34 #include "hsmenueventtransition.h" |
34 #include "hsmenueventtransition.h" |
35 #include "hsmainwindow.h" |
35 #include "hsmainwindow.h" |
|
36 #include "hsscene.h" |
36 |
37 |
37 #include "t_hsaddtohomescreenmockstate.h" |
38 #include "t_hsaddtohomescreenmockstate.h" |
38 #include "t_hsmockmodel.h" |
39 #include "t_hsmockmodel.h" |
39 #include "t_allcollectionsstate.h" |
40 #include "t_allcollectionsstate.h" |
40 |
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
41 class HsMainWindowMock : public HsMainWindow |
46 class HsMainWindowMock : public HsMainWindow |
42 { |
47 { |
43 virtual void setCurrentView(HbView *view); |
48 virtual void setCurrentView(HbView *view); |
44 |
49 |
45 }; |
50 }; |
46 |
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
47 void HsMainWindowMock::setCurrentView(HbView *view) |
56 void HsMainWindowMock::setCurrentView(HbView *view) |
48 { |
57 { |
49 Q_UNUSED(view); |
58 Q_UNUSED(view); |
50 // do nothing |
59 // do nothing |
51 } |
60 } |
52 |
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
53 void MenuStatesTest::initTestCase() |
66 void MenuStatesTest::initTestCase() |
54 { |
67 { |
55 // mWindow = NULL; |
68 // mWindow = NULL; |
56 } |
69 } |
57 |
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
58 void MenuStatesTest::init() |
75 void MenuStatesTest::init() |
59 { |
76 { |
60 // mWindow = new HbMainWindow; |
77 // mWindow = new HbMainWindow; |
61 } |
78 } |
62 |
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
63 void MenuStatesTest::cleanup() |
84 void MenuStatesTest::cleanup() |
64 { |
85 { |
65 qApp->processEvents(); |
86 qApp->processEvents(); |
66 // delete mWindow; |
87 // delete mWindow; |
67 // mWindow = NULL; |
88 // mWindow = NULL; |
68 } |
89 } |
69 |
90 |
70 // --------------------------------------------------------------------------- |
91 // --------------------------------------------------------------------------- |
|
92 // |
71 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
72 // |
94 // |
73 void MenuStatesTest::construction() |
95 void MenuStatesTest::construction() |
74 { |
96 { |
75 #ifdef Q_OS_SYMBIAN |
97 #ifdef Q_OS_SYMBIAN |
103 #endif//UT_MEMORY_CHECK |
125 #endif//UT_MEMORY_CHECK |
104 #endif//Q_OS_SYMBIAN |
126 #endif//Q_OS_SYMBIAN |
105 } |
127 } |
106 |
128 |
107 // --------------------------------------------------------------------------- |
129 // --------------------------------------------------------------------------- |
108 // --------------------------------------------------------------------------- |
130 // |
109 // |
131 // --------------------------------------------------------------------------- |
110 |
132 // |
111 void MenuStatesTest::addModeEnteredExited() |
133 void MenuStatesTest::addModeEnteredExited() |
112 { |
134 { |
113 #ifdef Q_OS_SYMBIAN |
135 #ifdef Q_OS_SYMBIAN |
114 User::ResetInactivityTime();//it should help for Viewserver11 panic |
136 User::ResetInactivityTime();//it should help for Viewserver11 panic |
115 #ifdef UT_MEMORY_CHECK |
137 #ifdef UT_MEMORY_CHECK |
138 #endif//UT_MEMORY_CHECK |
160 #endif//UT_MEMORY_CHECK |
139 #endif//Q_OS_SYMBIAN |
161 #endif//Q_OS_SYMBIAN |
140 } |
162 } |
141 |
163 |
142 // --------------------------------------------------------------------------- |
164 // --------------------------------------------------------------------------- |
143 // --------------------------------------------------------------------------- |
165 // |
144 // |
166 // --------------------------------------------------------------------------- |
145 |
167 // |
146 void MenuStatesTest::normalModeEnteredExited() |
168 void MenuStatesTest::normalModeEnteredExited() |
147 { |
169 { |
148 #ifdef Q_OS_SYMBIAN |
170 #ifdef Q_OS_SYMBIAN |
149 User::ResetInactivityTime();//it should help for Viewserver11 panic |
171 User::ResetInactivityTime();//it should help for Viewserver11 panic |
150 #ifdef UT_MEMORY_CHECK |
172 #ifdef UT_MEMORY_CHECK |
319 #endif//UT_MEMORY_CHECK |
343 #endif//UT_MEMORY_CHECK |
320 #endif//Q_OS_SYMBIAN |
344 #endif//Q_OS_SYMBIAN |
321 } |
345 } |
322 |
346 |
323 // --------------------------------------------------------------------------- |
347 // --------------------------------------------------------------------------- |
324 // --------------------------------------------------------------------------- |
348 // |
325 |
349 // --------------------------------------------------------------------------- |
|
350 // |
326 void MenuStatesTest::listItemLongPressed() |
351 void MenuStatesTest::listItemLongPressed() |
327 { |
352 { |
328 #ifdef Q_OS_SYMBIAN |
353 #ifdef Q_OS_SYMBIAN |
329 User::ResetInactivityTime();//it should help for Viewserver11 panic |
354 User::ResetInactivityTime();//it should help for Viewserver11 panic |
330 #ifdef UT_MEMORY_CHECK |
355 #ifdef UT_MEMORY_CHECK |
331 __UHEAP_MARK; |
356 __UHEAP_MARK; |
332 #endif//UT_MEMORY_CHECK |
357 #endif//UT_MEMORY_CHECK |
333 #endif//Q_OS_SYMBIAN |
358 #endif//Q_OS_SYMBIAN |
334 { |
359 { |
335 QScopedPointer<HbMainWindow> wind(new HbMainWindow); |
|
336 |
|
337 HsMenuViewBuilder builder; |
360 HsMenuViewBuilder builder; |
338 HsMenuModeWrapper menuMode; |
361 HsMenuModeWrapper menuMode; |
339 HsMainWindowMock mainWindow; |
362 HsMainWindowMock mainWindow; |
340 |
363 |
341 QStateMachine *machine = new QStateMachine(0); |
364 QStateMachine *machine = new QStateMachine(0); |
393 #endif//UT_MEMORY_CHECK |
417 #endif//UT_MEMORY_CHECK |
394 #endif//Q_OS_SYMBIAN |
418 #endif//Q_OS_SYMBIAN |
395 { |
419 { |
396 QScopedPointer<QStateMachine> machine(new QStateMachine(0)); |
420 QScopedPointer<QStateMachine> machine(new QStateMachine(0)); |
397 |
421 |
398 QScopedPointer<HbMainWindow> window(new HbMainWindow); |
422 //QScopedPointer<HbMainWindow> window(new HbMainWindow); |
399 |
423 //HsScene::setInstance( new HsScene(window.data()) ); |
400 HsMenuViewBuilder builder; |
424 |
401 HsMenuModeWrapper menuMode; |
425 HsMenuViewBuilder builder; |
402 HsMainWindow mainWindow; |
426 HsMenuModeWrapper menuMode; |
|
427 HsMainWindowMock mainWindow; |
403 |
428 |
404 QScopedPointer<HsAllCollectionsState> allCollectionsState (new HsAllCollectionsState( |
429 QScopedPointer<HsAllCollectionsState> allCollectionsState (new HsAllCollectionsState( |
405 builder, menuMode, mainWindow, machine.data())); |
430 builder, menuMode, mainWindow, machine.data())); |
406 |
431 |
407 |
432 |
454 #endif//UT_MEMORY_CHECK |
479 #endif//UT_MEMORY_CHECK |
455 #endif//Q_OS_SYMBIAN |
480 #endif//Q_OS_SYMBIAN |
456 } |
481 } |
457 |
482 |
458 // --------------------------------------------------------------------------- |
483 // --------------------------------------------------------------------------- |
459 // --------------------------------------------------------------------------- |
484 // |
460 |
485 // --------------------------------------------------------------------------- |
|
486 // |
461 void MenuStatesTest::addModeSlots() |
487 void MenuStatesTest::addModeSlots() |
462 { |
488 { |
463 #ifdef Q_OS_SYMBIAN |
489 #ifdef Q_OS_SYMBIAN |
464 User::ResetInactivityTime();//it should help for Viewserver11 panic |
490 User::ResetInactivityTime();//it should help for Viewserver11 panic |
465 #ifdef UT_MEMORY_CHECK |
491 #ifdef UT_MEMORY_CHECK |
494 // MockModel object is to provide CaEntry representing widget |
520 // MockModel object is to provide CaEntry representing widget |
495 // the object will be deleted on destruction of allAppsState |
521 // the object will be deleted on destruction of allAppsState |
496 allCollectionsState->scrollToBeginning(); |
522 allCollectionsState->scrollToBeginning(); |
497 allCollectionsState->stateEntered(); |
523 allCollectionsState->stateEntered(); |
498 |
524 |
499 |
|
500 machine->start(); |
525 machine->start(); |
501 qApp->sendPostedEvents(); |
526 qApp->sendPostedEvents(); |
502 |
527 |
503 allCollectionsState->addActivated(allCollectionsState->mModel->index(0,0)); |
528 allCollectionsState->addActivated(allCollectionsState->mModel->index(0,0)); |
504 |
529 |
505 qApp->sendPostedEvents(); |
530 qApp->sendPostedEvents(); |
506 |
531 |
507 QVERIFY(addToHomeScreenState.enteredValue()); |
532 QVERIFY(addToHomeScreenState.enteredValue()); |