changeset 97 | 66b5fe3c07fd |
parent 90 | 3ac3aaebaee5 |
95:32e56106abf2 | 97:66b5fe3c07fd |
---|---|
32 #include "t_hsmenuserviceprovider.h" |
32 #include "t_hsmenuserviceprovider.h" |
33 |
33 |
34 QTM_USE_NAMESPACE |
34 QTM_USE_NAMESPACE |
35 |
35 |
36 // --------------------------------------------------------------------------- |
36 // --------------------------------------------------------------------------- |
37 // |
|
37 // --------------------------------------------------------------------------- |
38 // --------------------------------------------------------------------------- |
38 // |
39 // |
39 void MenuServiceTest::MenuService_getAllApplicationsModel() |
40 void MenuServiceTest::MenuService_getAllApplicationsModel() |
40 { |
41 { |
41 #ifdef Q_OS_SYMBIAN |
42 #ifdef Q_OS_SYMBIAN |
94 #endif |
95 #endif |
95 |
96 |
96 } |
97 } |
97 |
98 |
98 // --------------------------------------------------------------------------- |
99 // --------------------------------------------------------------------------- |
100 // |
|
99 // --------------------------------------------------------------------------- |
101 // --------------------------------------------------------------------------- |
100 // |
102 // |
101 void MenuServiceTest::MenuService_getAllCollectionsModel() |
103 void MenuServiceTest::MenuService_getAllCollectionsModel() |
102 { |
104 { |
103 #ifdef Q_OS_SYMBIAN |
105 #ifdef Q_OS_SYMBIAN |
132 #endif |
134 #endif |
133 #endif |
135 #endif |
134 } |
136 } |
135 |
137 |
136 // --------------------------------------------------------------------------- |
138 // --------------------------------------------------------------------------- |
139 // |
|
137 // --------------------------------------------------------------------------- |
140 // --------------------------------------------------------------------------- |
138 // |
141 // |
139 void MenuServiceTest::MenuService_getInstalledModel() |
142 void MenuServiceTest::MenuService_getInstalledModel() |
140 { |
143 { |
141 #ifdef Q_OS_SYMBIAN |
144 #ifdef Q_OS_SYMBIAN |
188 #endif |
191 #endif |
189 #endif |
192 #endif |
190 } |
193 } |
191 |
194 |
192 // --------------------------------------------------------------------------- |
195 // --------------------------------------------------------------------------- |
196 // |
|
193 // --------------------------------------------------------------------------- |
197 // --------------------------------------------------------------------------- |
194 // |
198 // |
195 void MenuServiceTest::MenuService_getCollectionModel() |
199 void MenuServiceTest::MenuService_getCollectionModel() |
196 { |
200 { |
197 #ifdef Q_OS_SYMBIAN |
201 #ifdef Q_OS_SYMBIAN |
229 expectedQuery.setFlagsOn(RemovableEntryFlag | VisibleEntryFlag); |
233 expectedQuery.setFlagsOn(RemovableEntryFlag | VisibleEntryFlag); |
230 expectedQuery.setFlagsOff(MissingEntryFlag); |
234 expectedQuery.setFlagsOff(MissingEntryFlag); |
231 expectedQuery.setSort( |
235 expectedQuery.setSort( |
232 HsMenuServiceUtils::sortBy(Hs::NoHsSortAttribute), |
236 HsMenuServiceUtils::sortBy(Hs::NoHsSortAttribute), |
233 HsMenuServiceUtils::sortOrder(Hs::NoHsSortAttribute)); |
237 HsMenuServiceUtils::sortOrder(Hs::NoHsSortAttribute)); |
234 |
238 } |
235 |
239 #ifdef Q_OS_SYMBIAN |
236 } |
240 #ifdef UT_MEMORY_CHECK |
237 #ifdef Q_OS_SYMBIAN |
241 __UHEAP_MARKEND; |
238 #ifdef UT_MEMORY_CHECK |
242 #endif |
239 __UHEAP_MARKEND; |
243 #endif |
240 #endif |
244 } |
241 #endif |
245 |
242 } |
246 // --------------------------------------------------------------------------- |
243 |
247 // |
244 // --------------------------------------------------------------------------- |
|
245 // --------------------------------------------------------------------------- |
248 // --------------------------------------------------------------------------- |
246 // |
249 // |
247 void MenuServiceTest::MenuService_getCollectionNames() |
250 void MenuServiceTest::MenuService_getCollectionNames() |
248 { |
251 { |
249 #ifdef Q_OS_SYMBIAN |
252 #ifdef Q_OS_SYMBIAN |
250 #ifdef UT_MEMORY_CHECK |
253 #ifdef UT_MEMORY_CHECK |
251 __UHEAP_MARK; |
254 __UHEAP_MARK; |
252 #endif |
255 #endif |
253 #endif |
256 #endif |
254 { |
257 { |
255 |
|
256 |
|
257 |
|
258 QSharedPointer<CaEntry> collectionA(new CaEntry); |
258 QSharedPointer<CaEntry> collectionA(new CaEntry); |
259 collectionA->mTextResult = "A"; |
259 collectionA->mTextResult = "A"; |
260 QSharedPointer<CaEntry> collectionB(new CaEntry); |
260 QSharedPointer<CaEntry> collectionB(new CaEntry); |
261 collectionB->mTextResult = "B"; |
261 collectionB->mTextResult = "B"; |
262 |
262 |
288 #endif |
288 #endif |
289 #endif |
289 #endif |
290 } |
290 } |
291 |
291 |
292 // --------------------------------------------------------------------------- |
292 // --------------------------------------------------------------------------- |
293 // |
|
293 // --------------------------------------------------------------------------- |
294 // --------------------------------------------------------------------------- |
294 // |
295 // |
295 void MenuServiceTest::MenuService_getName() |
296 void MenuServiceTest::MenuService_getName() |
296 { |
297 { |
297 #ifdef Q_OS_SYMBIAN |
298 #ifdef Q_OS_SYMBIAN |
323 #endif |
324 #endif |
324 #endif |
325 #endif |
325 } |
326 } |
326 |
327 |
327 // --------------------------------------------------------------------------- |
328 // --------------------------------------------------------------------------- |
329 // |
|
328 // --------------------------------------------------------------------------- |
330 // --------------------------------------------------------------------------- |
329 // |
331 // |
330 void MenuServiceTest::MenuService_executeAction() |
332 void MenuServiceTest::MenuService_executeAction() |
331 { |
333 { |
332 #ifdef Q_OS_SYMBIAN |
334 #ifdef Q_OS_SYMBIAN |
359 #endif |
361 #endif |
360 #endif |
362 #endif |
361 } |
363 } |
362 |
364 |
363 // --------------------------------------------------------------------------- |
365 // --------------------------------------------------------------------------- |
366 // |
|
364 // --------------------------------------------------------------------------- |
367 // --------------------------------------------------------------------------- |
365 // |
368 // |
366 void MenuServiceTest::MenuService_executeActionEntry() |
369 void MenuServiceTest::MenuService_executeActionEntry() |
367 { |
370 { |
368 #ifdef Q_OS_SYMBIAN |
371 #ifdef Q_OS_SYMBIAN |
394 #endif |
397 #endif |
395 #endif |
398 #endif |
396 } |
399 } |
397 |
400 |
398 // --------------------------------------------------------------------------- |
401 // --------------------------------------------------------------------------- |
402 // |
|
399 // --------------------------------------------------------------------------- |
403 // --------------------------------------------------------------------------- |
400 // |
404 // |
401 #ifdef Q_OS_SYMBIAN |
405 #ifdef Q_OS_SYMBIAN |
402 void MenuServiceTest::MenuService_launchTS() |
406 void MenuServiceTest::MenuService_launchTS() |
403 { |
407 { |
411 __UHEAP_MARKEND; |
415 __UHEAP_MARKEND; |
412 #endif |
416 #endif |
413 } |
417 } |
414 #endif//Q_OS_SYMBIAN |
418 #endif//Q_OS_SYMBIAN |
415 |
419 |
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 // --------------------------------------------------------------------------- |
|
423 // |
|
416 void MenuServiceTest::MenuService_createCollection() |
424 void MenuServiceTest::MenuService_createCollection() |
417 { |
425 { |
418 #ifdef Q_OS_SYMBIAN |
426 #ifdef Q_OS_SYMBIAN |
419 #ifdef UT_MEMORY_CHECK |
427 #ifdef UT_MEMORY_CHECK |
420 __UHEAP_MARK; |
428 __UHEAP_MARK; |
461 __UHEAP_MARKEND; |
469 __UHEAP_MARKEND; |
462 #endif |
470 #endif |
463 #endif |
471 #endif |
464 } |
472 } |
465 |
473 |
474 // --------------------------------------------------------------------------- |
|
475 // |
|
476 // --------------------------------------------------------------------------- |
|
477 // |
|
466 void MenuServiceTest::MenuService_renameCollection() |
478 void MenuServiceTest::MenuService_renameCollection() |
467 { |
479 { |
468 #ifdef Q_OS_SYMBIAN |
480 #ifdef Q_OS_SYMBIAN |
469 #ifdef UT_MEMORY_CHECK |
481 #ifdef UT_MEMORY_CHECK |
470 __UHEAP_MARK; |
482 __UHEAP_MARK; |
497 __UHEAP_MARKEND; |
509 __UHEAP_MARKEND; |
498 #endif |
510 #endif |
499 #endif |
511 #endif |
500 } |
512 } |
501 |
513 |
514 // --------------------------------------------------------------------------- |
|
515 // |
|
516 // --------------------------------------------------------------------------- |
|
517 // |
|
502 void MenuServiceTest::MenuService_removeCollection() |
518 void MenuServiceTest::MenuService_removeCollection() |
503 { |
519 { |
504 #ifdef Q_OS_SYMBIAN |
520 #ifdef Q_OS_SYMBIAN |
505 #ifdef UT_MEMORY_CHECK |
521 #ifdef UT_MEMORY_CHECK |
506 __UHEAP_MARK; |
522 __UHEAP_MARK; |
524 __UHEAP_MARKEND; |
540 __UHEAP_MARKEND; |
525 #endif |
541 #endif |
526 #endif |
542 #endif |
527 } |
543 } |
528 |
544 |
529 |
545 // --------------------------------------------------------------------------- |
546 // |
|
547 // --------------------------------------------------------------------------- |
|
548 // |
|
530 void MenuServiceTest::MenuService_addApplicationsToCollection() |
549 void MenuServiceTest::MenuService_addApplicationsToCollection() |
531 { |
550 { |
532 #ifdef Q_OS_SYMBIAN |
551 #ifdef Q_OS_SYMBIAN |
533 #ifdef UT_MEMORY_CHECK |
552 #ifdef UT_MEMORY_CHECK |
534 __UHEAP_MARK; |
553 __UHEAP_MARK; |
557 __UHEAP_MARKEND; |
576 __UHEAP_MARKEND; |
558 #endif |
577 #endif |
559 #endif |
578 #endif |
560 } |
579 } |
561 |
580 |
581 // --------------------------------------------------------------------------- |
|
582 // |
|
583 // --------------------------------------------------------------------------- |
|
584 // |
|
562 void MenuServiceTest::MenuService_removeApplicationFromCollection() |
585 void MenuServiceTest::MenuService_removeApplicationFromCollection() |
563 { |
586 { |
564 #ifdef Q_OS_SYMBIAN |
587 #ifdef Q_OS_SYMBIAN |
565 #ifdef UT_MEMORY_CHECK |
588 #ifdef UT_MEMORY_CHECK |
566 __UHEAP_MARK; |
589 __UHEAP_MARK; |
589 __UHEAP_MARKEND; |
612 __UHEAP_MARKEND; |
590 #endif |
613 #endif |
591 #endif |
614 #endif |
592 } |
615 } |
593 |
616 |
594 |
617 // --------------------------------------------------------------------------- |
595 // --------------------------------------------------------------------------- |
618 // |
596 // --------------------------------------------------------------------------- |
619 // --------------------------------------------------------------------------- |
597 // |
620 // |
598 void MenuServiceTest::MenuService_organizeCollection() |
621 void MenuServiceTest::MenuService_organizeCollection() |
599 { |
622 { |
600 #ifdef Q_OS_SYMBIAN |
623 #ifdef Q_OS_SYMBIAN |
627 #endif |
650 #endif |
628 #endif |
651 #endif |
629 |
652 |
630 } |
653 } |
631 |
654 |
632 |
655 // --------------------------------------------------------------------------- |
633 // --------------------------------------------------------------------------- |
656 // |
634 // --------------------------------------------------------------------------- |
657 // --------------------------------------------------------------------------- |
635 // |
658 // |
636 void MenuServiceTest::MenuService_touchAction() |
659 void MenuServiceTest::MenuService_touchAction() |
637 { |
660 { |
638 #ifdef Q_OS_SYMBIAN |
661 #ifdef Q_OS_SYMBIAN |
677 #endif |
700 #endif |
678 #endif |
701 #endif |
679 |
702 |
680 } |
703 } |
681 |
704 |
682 |
705 // --------------------------------------------------------------------------- |
683 // --------------------------------------------------------------------------- |
706 // |
707 // --------------------------------------------------------------------------- |
|
708 // |
|
709 void MenuServiceTest::MenuService_touchAction_ByEntry() |
|
710 { |
|
711 #ifdef Q_OS_SYMBIAN |
|
712 #ifdef UT_MEMORY_CHECK |
|
713 __UHEAP_MARK; |
|
714 #endif |
|
715 #endif |
|
716 { |
|
717 QSharedPointer<CaService> service = CaService::instance(); |
|
718 |
|
719 ////touch on unused entry |
|
720 const int touchedEntryId = 5; |
|
721 QSharedPointer<CaEntry> touchedEntry(new CaEntry); |
|
722 touchedEntry->mIdResult = touchedEntryId; |
|
723 touchedEntry->setText("GHI"); |
|
724 touchedEntry->setFlags(RemovableEntryFlag | VisibleEntryFlag); |
|
725 service->mGetEntryResult = touchedEntry; |
|
726 service->mTouchResult = true; |
|
727 |
|
728 HsMenuService::touch(*touchedEntry); |
|
729 QCOMPARE(service->mTouchEntry.id(), touchedEntryId); |
|
730 QCOMPARE(service->mTouchEntry.text(), touchedEntry->text()); |
|
731 |
|
732 ////touch on already used entry |
|
733 const int unTouchedEntryId = 5; |
|
734 QSharedPointer<CaEntry> unTouchedEntry(new CaEntry); |
|
735 unTouchedEntry->mIdResult = unTouchedEntryId; |
|
736 unTouchedEntry->setText("GHI_UT"); |
|
737 unTouchedEntry->setFlags(0); |
|
738 service->mGetEntryResult = unTouchedEntry; |
|
739 service->mTouchResult = true; |
|
740 |
|
741 HsMenuService::touch(*touchedEntry); |
|
742 QCOMPARE(service->mTouchEntry.id(), touchedEntryId); |
|
743 QCOMPARE(service->mTouchEntry.text(), touchedEntry->text()); |
|
744 } |
|
745 #ifdef Q_OS_SYMBIAN |
|
746 #ifdef UT_MEMORY_CHECK |
|
747 __UHEAP_MARKEND; |
|
748 #endif |
|
749 #endif |
|
750 |
|
751 } |
|
752 |
|
753 // --------------------------------------------------------------------------- |
|
754 // |
|
684 // --------------------------------------------------------------------------- |
755 // --------------------------------------------------------------------------- |
685 // |
756 // |
686 void MenuServiceTest::MenuService_touchListOfIdsAction() |
757 void MenuServiceTest::MenuService_touchListOfIdsAction() |
687 { |
758 { |
688 #ifdef Q_OS_SYMBIAN |
759 #ifdef Q_OS_SYMBIAN |
728 __UHEAP_MARKEND; |
799 __UHEAP_MARKEND; |
729 #endif |
800 #endif |
730 #endif |
801 #endif |
731 } |
802 } |
732 |
803 |
733 |
804 // --------------------------------------------------------------------------- |
734 // --------------------------------------------------------------------------- |
805 // |
735 // --------------------------------------------------------------------------- |
806 // --------------------------------------------------------------------------- |
736 // |
807 // |
737 void MenuServiceTest::MenuService_launchSoftwareUpdate() |
808 void MenuServiceTest::MenuService_launchSoftwareUpdate() |
738 { |
809 { |
739 #ifdef Q_OS_SYMBIAN |
810 #ifdef Q_OS_SYMBIAN |
761 #endif |
832 #endif |
762 #endif |
833 #endif |
763 } |
834 } |
764 |
835 |
765 // --------------------------------------------------------------------------- |
836 // --------------------------------------------------------------------------- |
837 // |
|
766 // --------------------------------------------------------------------------- |
838 // --------------------------------------------------------------------------- |
767 // |
839 // |
768 void MenuServiceTest::MenuService_collectionIdByType() |
840 void MenuServiceTest::MenuService_collectionIdByType() |
769 { |
841 { |
770 #ifdef Q_OS_SYMBIAN |
842 #ifdef Q_OS_SYMBIAN |
787 __UHEAP_MARKEND; |
859 __UHEAP_MARKEND; |
788 #endif |
860 #endif |
789 #endif |
861 #endif |
790 } |
862 } |
791 |
863 |
792 |
864 // --------------------------------------------------------------------------- |
793 // --------------------------------------------------------------------------- |
865 // |
794 // --------------------------------------------------------------------------- |
866 // --------------------------------------------------------------------------- |
795 // |
867 // |
796 void MenuServiceTest::initTestCase() |
868 void MenuServiceTest::initTestCase() |
797 { |
869 { |
798 const int allCollectionId = 8; |
870 const int allCollectionId = 8; |
804 |
876 |
805 void MenuServiceTest::cleanup() |
877 void MenuServiceTest::cleanup() |
806 { |
878 { |
807 CaService::instance()->clear(); |
879 CaService::instance()->clear(); |
808 } |
880 } |
809 // --------------------------------------------------------------------------- |
881 |
882 // --------------------------------------------------------------------------- |
|
883 // |
|
810 // --------------------------------------------------------------------------- |
884 // --------------------------------------------------------------------------- |
811 // |
885 // |
812 void MenuServiceTest::cleanupTestCase() |
886 void MenuServiceTest::cleanupTestCase() |
813 { |
887 { |
814 #ifdef Q_OS_SYMBIAN |
888 #ifdef Q_OS_SYMBIAN |
815 // stopThread(); |
889 // stopThread(); |
816 #endif //Q_OS_SYMBIAN |
890 #endif //Q_OS_SYMBIAN |
817 } |
891 } |
818 |
892 |
819 |
893 // --------------------------------------------------------------------------- |
820 // --------------------------------------------------------------------------- |
894 // |
821 // --------------------------------------------------------------------------- |
895 // --------------------------------------------------------------------------- |
896 // |
|
822 int threadFunction(void *params) |
897 int threadFunction(void *params) |
823 { |
898 { |
824 Q_UNUSED(params) |
899 Q_UNUSED(params) |
825 #ifdef Q_OS_SYMBIAN |
900 #ifdef Q_OS_SYMBIAN |
826 while (ETrue) { |
901 while (ETrue) { |
832 } |
907 } |
833 |
908 |
834 #ifdef Q_OS_SYMBIAN |
909 #ifdef Q_OS_SYMBIAN |
835 |
910 |
836 // --------------------------------------------------------------------------- |
911 // --------------------------------------------------------------------------- |
912 // |
|
837 // --------------------------------------------------------------------------- |
913 // --------------------------------------------------------------------------- |
838 // |
914 // |
839 void MenuServiceTest::startThread() |
915 void MenuServiceTest::startThread() |
840 { |
916 { |
841 User::LeaveIfError(iThread.Create( |
917 User::LeaveIfError(iThread.Create( |
850 #endif //Q_OS_SYMBIAN |
926 #endif //Q_OS_SYMBIAN |
851 |
927 |
852 |
928 |
853 #ifdef Q_OS_SYMBIAN |
929 #ifdef Q_OS_SYMBIAN |
854 |
930 |
855 // --------------------------------------------------------------------------- |
931 |
932 // --------------------------------------------------------------------------- |
|
933 // |
|
856 // --------------------------------------------------------------------------- |
934 // --------------------------------------------------------------------------- |
857 // |
935 // |
858 void MenuServiceTest::stopThread() |
936 void MenuServiceTest::stopThread() |
859 { |
937 { |
860 iThread.Close(); |
938 iThread.Close(); |