39 |
41 |
40 void testCreateAndDestroy(); |
42 void testCreateAndDestroy(); |
41 |
43 |
42 void testCaptureKey_data(); |
44 void testCaptureKey_data(); |
43 void testCaptureKey(); |
45 void testCaptureKey(); |
|
46 |
|
47 void testCaptureKey_S60_data(); |
|
48 void testCaptureKey_S60(); |
44 |
49 |
45 void testCaptureKeyUpAndDowns_data(); |
50 void testCaptureKeyUpAndDowns_data(); |
46 void testCaptureKeyUpAndDowns(); |
51 void testCaptureKeyUpAndDowns(); |
|
52 |
|
53 void testCaptureKeyUpAndDowns_S60_data(); |
|
54 void testCaptureKeyUpAndDowns_S60(); |
47 |
55 |
48 void testCaptureLongKey_data(); |
56 void testCaptureLongKey_data(); |
49 void testCaptureLongKey(); |
57 void testCaptureLongKey(); |
|
58 |
|
59 void testCaptureLongKey_S60_data(); |
|
60 void testCaptureLongKey_S60(); |
50 |
61 |
51 void testCancelCaptureKey_data(); |
62 void testCancelCaptureKey_data(); |
52 void testCancelCaptureKey(); |
63 void testCancelCaptureKey(); |
|
64 |
|
65 void testCancelCaptureKey_S60_data(); |
|
66 void testCancelCaptureKey_S60(); |
53 |
67 |
54 void testCancelCaptureKeyUpAndDowns_data(); |
68 void testCancelCaptureKeyUpAndDowns_data(); |
55 void testCancelCaptureKeyUpAndDowns(); |
69 void testCancelCaptureKeyUpAndDowns(); |
|
70 |
|
71 void testCancelCaptureKeyUpAndDowns_S60_data(); |
|
72 void testCancelCaptureKeyUpAndDowns_S60(); |
56 |
73 |
57 void testCancelCaptureLongKey_data(); |
74 void testCancelCaptureLongKey_data(); |
58 void testCancelCaptureLongKey(); |
75 void testCancelCaptureLongKey(); |
59 |
76 |
|
77 void testCancelCaptureLongKey_S60_data(); |
|
78 void testCancelCaptureLongKey_S60(); |
|
79 |
60 void testErrorString(); |
80 void testErrorString(); |
61 void testErrorId(); |
81 void testErrorId(); |
|
82 |
|
83 void testKeyMapperFile(); |
|
84 |
|
85 private: |
|
86 QString clearString(const QString& line, const QString& prefix, const QString& comment); |
62 |
87 |
63 private: |
88 private: |
64 XqKeyCapture* keyCapture; |
89 XqKeyCapture* keyCapture; |
65 |
90 |
66 Qt::Key aKey; |
91 Qt::Key aKey; |
291 additionalResults.clear(); |
316 additionalResults.clear(); |
292 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
317 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
293 |
318 |
294 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
319 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
295 keyCapture->captureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
320 keyCapture->captureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
|
321 } |
|
322 |
|
323 //////////////////////////////////////////////////////////////// |
|
324 //Capture Key Up And Downs |
|
325 //////////////////////////////////////////////////////////////// |
|
326 void TestXqKeyCapture::testCaptureKeyUpAndDowns_S60_data() |
|
327 { |
|
328 QTest::addColumn<unsigned int>("qtKey"); |
|
329 QTest::addColumn<unsigned int>("qtMask"); |
|
330 QTest::addColumn<unsigned int>("qtModifier"); |
|
331 |
|
332 QTest::addColumn<unsigned int>("symbianKey"); |
|
333 QTest::addColumn<unsigned int>("symbianMask"); |
|
334 QTest::addColumn<unsigned int>("symbianModifier"); |
|
335 |
|
336 QTest::addColumn<long int>("reqNum"); |
|
337 |
|
338 QTest::addColumn<bool>("additional"); |
|
339 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
|
340 |
|
341 QTest::newRow("esc_key") << static_cast<unsigned int> ( EStdKeyEscape ) |
|
342 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
343 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
344 << static_cast<unsigned int> ( EStdKeyEscape ) |
|
345 << static_cast<unsigned int> ( 0 ) |
|
346 << static_cast<unsigned int> ( 0 ) |
|
347 << static_cast<long int> ( 12 ) |
|
348 << false |
|
349 << static_cast<unsigned int> ( 0 ); |
|
350 } |
|
351 |
|
352 void TestXqKeyCapture::testCaptureKeyUpAndDowns_S60() |
|
353 { |
|
354 numOfArgs = 3; |
|
355 actionType = WGATCaptureKeyUpAndDowns; |
|
356 additionalResult = false; |
|
357 ignoreWindowGroupAction = false; |
|
358 |
|
359 QFETCH(unsigned int, qtKey); |
|
360 QFETCH(unsigned int, qtMask); |
|
361 QFETCH(unsigned int, qtModifier); |
|
362 |
|
363 QFETCH(unsigned int, symbianKey); |
|
364 QFETCH(unsigned int, symbianMask); |
|
365 QFETCH(unsigned int, symbianModifier); |
|
366 |
|
367 QFETCH(long int, reqNum); |
|
368 |
|
369 QFETCH(bool, additional); |
|
370 QFETCH(unsigned int, additionalSymbianKey); |
|
371 |
|
372 willBeAdditionalRequest = additional; |
|
373 |
|
374 results.clear(); |
|
375 results << symbianKey << symbianMask << symbianModifier; |
|
376 |
|
377 additionalResults.clear(); |
|
378 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
|
379 |
|
380 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
|
381 keyCapture->captureKeyUpAndDowns( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
296 } |
382 } |
297 |
383 |
298 //////////////////////////////////////////////////////////////// |
384 //////////////////////////////////////////////////////////////// |
299 //Capture Long Key |
385 //Capture Long Key |
300 //////////////////////////////////////////////////////////////// |
386 //////////////////////////////////////////////////////////////// |
363 additionalResults.clear(); |
449 additionalResults.clear(); |
364 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
450 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
365 |
451 |
366 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
452 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
367 keyCapture->captureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XqKeyCapture::LongFlags> (longFlags) ); |
453 keyCapture->captureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XqKeyCapture::LongFlags> (longFlags) ); |
|
454 } |
|
455 |
|
456 //////////////////////////////////////////////////////////////// |
|
457 //Capture Long Key |
|
458 //////////////////////////////////////////////////////////////// |
|
459 void TestXqKeyCapture::testCaptureLongKey_S60_data() |
|
460 { |
|
461 QTest::addColumn<unsigned int>("qtKey"); |
|
462 QTest::addColumn<unsigned int>("qtMask"); |
|
463 QTest::addColumn<unsigned int>("qtModifier"); |
|
464 QTest::addColumn<int>("longFlags"); |
|
465 |
|
466 QTest::addColumn<unsigned int>("symbianKey"); |
|
467 QTest::addColumn<unsigned int>("symbianMask"); |
|
468 QTest::addColumn<unsigned int>("symbianModifier"); |
|
469 QTest::addColumn<int>("symbianPriority"); |
|
470 QTest::addColumn<int>("symbianLongFlags"); |
|
471 |
|
472 QTest::addColumn<long int>("reqNum"); |
|
473 |
|
474 QTest::addColumn<bool>("additional"); |
|
475 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
|
476 |
|
477 |
|
478 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
|
479 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
480 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
481 << static_cast<int> ( XqKeyCapture::LongNormal ) |
|
482 << static_cast<unsigned int> ( EKeyEscape ) |
|
483 << static_cast<unsigned int> ( 0 ) |
|
484 << static_cast<unsigned int> ( 0 ) |
|
485 << static_cast<int> ( 0 ) //priority |
|
486 << static_cast<int> ( XqKeyCapture::LongNormal ) |
|
487 << static_cast<long int> ( 12 ) |
|
488 << false |
|
489 << static_cast<unsigned int> ( 0 ); |
|
490 |
|
491 } |
|
492 |
|
493 void TestXqKeyCapture::testCaptureLongKey_S60() |
|
494 { |
|
495 numOfArgs = 6; |
|
496 actionType = WGATCaptureLongKey; |
|
497 additionalResult = false; |
|
498 ignoreWindowGroupAction = false; |
|
499 |
|
500 QFETCH(unsigned int, qtKey); |
|
501 QFETCH(unsigned int, qtMask); |
|
502 QFETCH(unsigned int, qtModifier); |
|
503 QFETCH(int, longFlags); |
|
504 |
|
505 QFETCH(unsigned int, symbianKey); |
|
506 QFETCH(unsigned int, symbianMask); |
|
507 QFETCH(unsigned int, symbianModifier); |
|
508 QFETCH(int, symbianPriority); |
|
509 QFETCH(int, symbianLongFlags); |
|
510 |
|
511 QFETCH(long int, reqNum); |
|
512 |
|
513 QFETCH(bool, additional); |
|
514 QFETCH(unsigned int, additionalSymbianKey); |
|
515 |
|
516 willBeAdditionalRequest = additional; |
|
517 |
|
518 results.clear(); |
|
519 results << symbianKey << symbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
|
520 |
|
521 additionalResults.clear(); |
|
522 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
|
523 |
|
524 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
|
525 keyCapture->captureLongKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XqKeyCapture::LongFlags> (longFlags) ); |
368 } |
526 } |
369 |
527 |
370 //////////////////////////////////////////////////////////////// |
528 //////////////////////////////////////////////////////////////// |
371 // CANCEL |
529 // CANCEL |
372 //Cancel Capture Key |
530 //Cancel Capture Key |
458 willBeAdditionalRequest = additional; |
616 willBeAdditionalRequest = additional; |
459 keyCapture->cancelCaptureKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
617 keyCapture->cancelCaptureKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
460 } |
618 } |
461 |
619 |
462 //////////////////////////////////////////////////////////////// |
620 //////////////////////////////////////////////////////////////// |
|
621 // CANCEL |
|
622 //Cancel Capture Key |
|
623 //////////////////////////////////////////////////////////////// |
|
624 void TestXqKeyCapture::testCancelCaptureKey_S60_data() |
|
625 { |
|
626 QTest::addColumn<unsigned int>("qtKey"); |
|
627 QTest::addColumn<unsigned int>("qtMask"); |
|
628 QTest::addColumn<unsigned int>("qtModifier"); |
|
629 |
|
630 QTest::addColumn<long int>("reqNum"); |
|
631 |
|
632 QTest::addColumn<bool>("additional"); |
|
633 QTest::addColumn<long int>("additionalReqNum"); |
|
634 |
|
635 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
|
636 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
637 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
638 << static_cast<long int> ( 12 ) |
|
639 << false |
|
640 << static_cast<long int> ( 0 ); |
|
641 |
|
642 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int> ( EKeyEscape ) |
|
643 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
644 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
645 << static_cast<long int> ( KErrNotSupported ) |
|
646 << false |
|
647 << static_cast<long int> ( 0 ); |
|
648 |
|
649 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int> ( EKeyEscape ) |
|
650 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
|
651 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
|
652 << static_cast<long int> ( 13 ) |
|
653 << false |
|
654 << static_cast<long int> ( 0 ); |
|
655 |
|
656 QTest::newRow("shift_key") << static_cast<unsigned int> ( EKeyLeftShift ) |
|
657 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
|
658 << static_cast<unsigned int> ( Qt::ControlModifier ) |
|
659 << static_cast<long int> ( 15 ) |
|
660 << true |
|
661 << static_cast<long int> ( 16 ); |
|
662 |
|
663 QTest::newRow("control_key") << static_cast<unsigned int> ( EKeyLeftCtrl ) |
|
664 << static_cast<unsigned int> ( Qt::ControlModifier ) |
|
665 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
|
666 << static_cast<long int> ( 17 ) |
|
667 << true |
|
668 << static_cast<long int> ( 18 ); |
|
669 |
|
670 QTest::newRow("meta_key") << static_cast<unsigned int> ( EKeyRightCtrl ) |
|
671 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
672 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
673 << static_cast<long int> ( 19 ) |
|
674 << true |
|
675 << static_cast<long int> ( 20 ); |
|
676 |
|
677 |
|
678 } |
|
679 |
|
680 void TestXqKeyCapture::testCancelCaptureKey_S60() |
|
681 { |
|
682 numOfArgs = 1; |
|
683 actionType = WGATCancelCaptureKey; |
|
684 additionalResult = false; |
|
685 |
|
686 QFETCH(unsigned int, qtKey); |
|
687 QFETCH(unsigned int, qtMask); |
|
688 QFETCH(unsigned int, qtModifier); |
|
689 |
|
690 QFETCH(long int, reqNum); |
|
691 |
|
692 QFETCH(bool, additional); |
|
693 QFETCH(long int, additionalReqNum); |
|
694 |
|
695 willBeAdditionalRequest = additional; |
|
696 additionalRequestHandle = additionalReqNum; |
|
697 |
|
698 cancelResults.clear(); |
|
699 cancelResults << reqNum; |
|
700 |
|
701 cancelAdditionalResults.clear(); |
|
702 cancelAdditionalResults << additionalReqNum; |
|
703 |
|
704 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
|
705 ignoreWindowGroupAction = true; |
|
706 keyCapture->captureKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
|
707 ignoreWindowGroupAction = false; |
|
708 willBeAdditionalRequest = additional; |
|
709 keyCapture->cancelCaptureKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
|
710 } |
|
711 |
|
712 //////////////////////////////////////////////////////////////// |
463 //Cancel Capture Key Up And Downs |
713 //Cancel Capture Key Up And Downs |
464 //////////////////////////////////////////////////////////////// |
714 //////////////////////////////////////////////////////////////// |
465 void TestXqKeyCapture::testCancelCaptureKeyUpAndDowns_data() |
715 void TestXqKeyCapture::testCancelCaptureKeyUpAndDowns_data() |
466 { |
716 { |
467 QTest::addColumn<unsigned int>("qtKey"); |
717 QTest::addColumn<unsigned int>("qtKey"); |
513 willBeAdditionalRequest = additional; |
763 willBeAdditionalRequest = additional; |
514 keyCapture->cancelCaptureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
764 keyCapture->cancelCaptureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
515 } |
765 } |
516 |
766 |
517 //////////////////////////////////////////////////////////////// |
767 //////////////////////////////////////////////////////////////// |
|
768 //Cancel Capture Key Up And Downs |
|
769 //////////////////////////////////////////////////////////////// |
|
770 void TestXqKeyCapture::testCancelCaptureKeyUpAndDowns_S60_data() |
|
771 { |
|
772 QTest::addColumn<unsigned int>("qtKey"); |
|
773 QTest::addColumn<unsigned int>("qtMask"); |
|
774 QTest::addColumn<unsigned int>("qtModifier"); |
|
775 |
|
776 QTest::addColumn<long int>("reqNum"); |
|
777 |
|
778 QTest::addColumn<bool>("additional"); |
|
779 QTest::addColumn<long int>("additionalReqNum"); |
|
780 |
|
781 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
|
782 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
783 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
784 << static_cast<long int> ( 34 ) |
|
785 << false |
|
786 << static_cast<long int> ( 35 ); |
|
787 |
|
788 } |
|
789 |
|
790 void TestXqKeyCapture::testCancelCaptureKeyUpAndDowns_S60() |
|
791 { |
|
792 numOfArgs = 1; |
|
793 actionType = WGATCancelCaptureKeyUpAndDowns; |
|
794 additionalResult = false; |
|
795 |
|
796 QFETCH(unsigned int, qtKey); |
|
797 QFETCH(unsigned int, qtMask); |
|
798 QFETCH(unsigned int, qtModifier); |
|
799 |
|
800 QFETCH(long int, reqNum); |
|
801 |
|
802 QFETCH(bool, additional); |
|
803 QFETCH(long int, additionalReqNum); |
|
804 |
|
805 willBeAdditionalRequest = additional; |
|
806 additionalRequestHandle = additionalReqNum; |
|
807 |
|
808 cancelResults.clear(); |
|
809 cancelResults << reqNum; |
|
810 |
|
811 cancelAdditionalResults.clear(); |
|
812 cancelAdditionalResults << additionalReqNum; |
|
813 |
|
814 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
|
815 ignoreWindowGroupAction = true; |
|
816 keyCapture->captureKeyUpAndDowns( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
|
817 ignoreWindowGroupAction = false; |
|
818 willBeAdditionalRequest = additional; |
|
819 keyCapture->cancelCaptureKeyUpAndDowns( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
|
820 } |
|
821 |
|
822 //////////////////////////////////////////////////////////////// |
518 //Cancel Capture Long Key |
823 //Cancel Capture Long Key |
519 //////////////////////////////////////////////////////////////// |
824 //////////////////////////////////////////////////////////////// |
520 void TestXqKeyCapture::testCancelCaptureLongKey_data() |
825 void TestXqKeyCapture::testCancelCaptureLongKey_data() |
521 { |
826 { |
522 QTest::addColumn<unsigned int>("qtKey"); |
827 QTest::addColumn<unsigned int>("qtKey"); |
575 willBeAdditionalRequest = additional; |
880 willBeAdditionalRequest = additional; |
576 keyCapture->cancelCaptureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XqKeyCapture::LongFlags> (longFlags) ); |
881 keyCapture->cancelCaptureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XqKeyCapture::LongFlags> (longFlags) ); |
577 } |
882 } |
578 |
883 |
579 //////////////////////////////////////////////////////////////// |
884 //////////////////////////////////////////////////////////////// |
|
885 //Cancel Capture Long Key |
|
886 //////////////////////////////////////////////////////////////// |
|
887 void TestXqKeyCapture::testCancelCaptureLongKey_S60_data() |
|
888 { |
|
889 QTest::addColumn<unsigned int>("qtKey"); |
|
890 QTest::addColumn<unsigned int>("qtMask"); |
|
891 QTest::addColumn<unsigned int>("qtModifier"); |
|
892 QTest::addColumn<int>("longFlags"); |
|
893 |
|
894 QTest::addColumn<long int>("reqNum"); |
|
895 |
|
896 QTest::addColumn<bool>("additional"); |
|
897 QTest::addColumn<long int>("additionalReqNum"); |
|
898 |
|
899 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
|
900 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
901 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
902 << static_cast<int> ( XqKeyCapture::LongNormal ) |
|
903 << static_cast<long int> ( 22 ) |
|
904 << false |
|
905 << static_cast<long int> ( 23 ); |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 } |
|
912 |
|
913 void TestXqKeyCapture::testCancelCaptureLongKey_S60() |
|
914 { |
|
915 numOfArgs = 1; |
|
916 actionType = WGATCancelCaptureLongKey; |
|
917 additionalResult = false; |
|
918 |
|
919 QFETCH(unsigned int, qtKey); |
|
920 QFETCH(unsigned int, qtMask); |
|
921 QFETCH(unsigned int, qtModifier); |
|
922 QFETCH(int, longFlags); |
|
923 |
|
924 QFETCH(long int, reqNum); |
|
925 |
|
926 QFETCH(bool, additional); |
|
927 QFETCH(long int, additionalReqNum); |
|
928 |
|
929 willBeAdditionalRequest = additional; |
|
930 additionalRequestHandle = additionalReqNum; |
|
931 |
|
932 cancelResults.clear(); |
|
933 cancelResults << reqNum; |
|
934 |
|
935 cancelAdditionalResults.clear(); |
|
936 cancelAdditionalResults << additionalReqNum; |
|
937 |
|
938 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
|
939 ignoreWindowGroupAction = true; |
|
940 keyCapture->captureLongKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XqKeyCapture::LongFlags> (longFlags) ); |
|
941 ignoreWindowGroupAction = false; |
|
942 willBeAdditionalRequest = additional; |
|
943 keyCapture->cancelCaptureLongKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XqKeyCapture::LongFlags> (longFlags) ); |
|
944 } |
|
945 |
|
946 void TestXqKeyCapture::testCaptureKey_S60_data() |
|
947 { |
|
948 QTest::addColumn<unsigned int>("s60Key"); |
|
949 QTest::addColumn<unsigned int>("qtMask"); |
|
950 QTest::addColumn<unsigned int>("qtModifier"); |
|
951 |
|
952 QTest::addColumn<unsigned int>("symbianKey"); |
|
953 QTest::addColumn<unsigned int>("symbianMask"); |
|
954 QTest::addColumn<unsigned int>("symbianModifier"); |
|
955 |
|
956 QTest::addColumn<long int>("reqNum"); |
|
957 |
|
958 QTest::addColumn<bool>("additional"); |
|
959 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
|
960 |
|
961 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
|
962 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
963 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
964 << static_cast<unsigned int> ( EKeyEscape ) |
|
965 << static_cast<unsigned int> ( 0 ) |
|
966 << static_cast<unsigned int> ( 0 ) |
|
967 << static_cast<long int> ( 12 ) |
|
968 << false |
|
969 << static_cast<unsigned int> ( 0 ); |
|
970 |
|
971 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int> ( EKeyEscape ) |
|
972 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
973 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
974 << static_cast<unsigned int> ( EKeyEscape ) |
|
975 << static_cast<unsigned int> ( 0 ) |
|
976 << static_cast<unsigned int> ( 0 ) |
|
977 << static_cast<long int> ( KErrNotSupported ) |
|
978 << false |
|
979 << static_cast<unsigned int> ( 0 ); |
|
980 |
|
981 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int> ( EKeyEscape ) |
|
982 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
|
983 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
|
984 << static_cast<unsigned int> ( EKeyEscape ) |
|
985 << static_cast<unsigned int> ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) |
|
986 << static_cast<unsigned int> ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) |
|
987 << static_cast<long int> ( 13 ) |
|
988 << false |
|
989 << static_cast<unsigned int> ( 0 ); |
|
990 |
|
991 QTest::newRow("shift_key") << static_cast<unsigned int> ( EKeyLeftShift ) |
|
992 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
|
993 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
|
994 << static_cast<unsigned int> ( EKeyLeftShift ) |
|
995 << static_cast<unsigned int> ( EModifierShift ) |
|
996 << static_cast<unsigned int> ( EModifierShift ) |
|
997 << static_cast<long int> ( 12 ) |
|
998 << true |
|
999 << static_cast<unsigned int> ( EKeyRightShift ); |
|
1000 |
|
1001 QTest::newRow("control_key") << static_cast<unsigned int> ( EKeyRightCtrl ) |
|
1002 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
1003 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
1004 << static_cast<unsigned int> ( EKeyRightCtrl ) |
|
1005 << static_cast<unsigned int> ( 0 ) |
|
1006 << static_cast<unsigned int> ( 0 ) |
|
1007 << static_cast<long int> ( 12 ) |
|
1008 << true |
|
1009 << static_cast<unsigned int> ( EKeyRightFunc ); |
|
1010 |
|
1011 QTest::newRow("meta_key") << static_cast<unsigned int> ( EKeyLeftCtrl ) |
|
1012 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
1013 << static_cast<unsigned int> ( Qt::NoModifier ) |
|
1014 << static_cast<unsigned int> ( EKeyLeftCtrl ) |
|
1015 << static_cast<unsigned int> ( 0 ) |
|
1016 << static_cast<unsigned int> ( 0 ) |
|
1017 << static_cast<long int> ( 12 ) |
|
1018 << true |
|
1019 << static_cast<unsigned int> ( EKeyLeftFunc ); |
|
1020 |
|
1021 |
|
1022 } |
|
1023 |
|
1024 void TestXqKeyCapture::testCaptureKey_S60() |
|
1025 { |
|
1026 numOfArgs = 3; |
|
1027 actionType = WGATCaptureKey; |
|
1028 additionalResult = false; |
|
1029 ignoreWindowGroupAction = false; |
|
1030 |
|
1031 QFETCH(unsigned int, s60Key); |
|
1032 QFETCH(unsigned int, qtMask); |
|
1033 QFETCH(unsigned int, qtModifier); |
|
1034 |
|
1035 QFETCH(unsigned int, symbianKey); |
|
1036 QFETCH(unsigned int, symbianMask); |
|
1037 QFETCH(unsigned int, symbianModifier); |
|
1038 |
|
1039 QFETCH(long int, reqNum); |
|
1040 |
|
1041 QFETCH(bool, additional); |
|
1042 QFETCH(unsigned int, additionalSymbianKey); |
|
1043 |
|
1044 willBeAdditionalRequest = additional; |
|
1045 |
|
1046 results.clear(); |
|
1047 results << symbianKey << symbianMask << symbianModifier; |
|
1048 |
|
1049 additionalResults.clear(); |
|
1050 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
|
1051 |
|
1052 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
|
1053 keyCapture->captureKey( static_cast<TUint> (s60Key), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
|
1054 } |
|
1055 |
|
1056 //////////////////////////////////////////////////////////////// |
580 // ERRORS |
1057 // ERRORS |
581 //errorString |
1058 //errorString |
582 //////////////////////////////////////////////////////////////// |
1059 //////////////////////////////////////////////////////////////// |
583 void TestXqKeyCapture::testErrorString() |
1060 void TestXqKeyCapture::testErrorString() |
584 { |
1061 { |
591 //////////////////////////////////////////////////////////////// |
1068 //////////////////////////////////////////////////////////////// |
592 void TestXqKeyCapture::testErrorId() |
1069 void TestXqKeyCapture::testErrorId() |
593 { |
1070 { |
594 keyCapture->errorId(); |
1071 keyCapture->errorId(); |
595 } |
1072 } |
|
1073 |
|
1074 QString TestXqKeyCapture::clearString(const QString& line, const QString& prefix, const QString& comment) { |
|
1075 QString s(line); |
|
1076 s.replace(prefix, comment); |
|
1077 s.replace(" ", ""); |
|
1078 s.replace("\t", ""); |
|
1079 return s.trimmed(); |
|
1080 } |
|
1081 |
|
1082 //////////////////////////////////////////////////////////////// |
|
1083 // TEST KEY MAPPER FILE |
|
1084 //////////////////////////////////////////////////////////////// |
|
1085 void TestXqKeyCapture::testKeyMapperFile() |
|
1086 { |
|
1087 QString prefix(" keyMapping.append(KeyMapping("); |
|
1088 QString comment("//"); |
|
1089 |
|
1090 QStringList qt; |
|
1091 QStringList kc; |
|
1092 |
|
1093 QFile qtFile("c:\qkeymapper_s60.cpp"); |
|
1094 QVERIFY(qtFile.open(QIODevice::ReadOnly | QIODevice::Text)); |
|
1095 |
|
1096 QFile kcFile("c:\keymapper.cpp"); |
|
1097 QVERIFY(kcFile.open(QIODevice::ReadOnly | QIODevice::Text)); |
|
1098 |
|
1099 QTextStream inQtFile(&qtFile); |
|
1100 while (!inQtFile.atEnd()) { |
|
1101 QString line = inQtFile.readLine(); |
|
1102 if (line.contains(prefix) && !line.contains(comment)) { |
|
1103 qt.append(clearString(line, prefix, comment)); |
|
1104 } |
|
1105 } |
|
1106 |
|
1107 QTextStream inKcFile(&kcFile); |
|
1108 while (!inKcFile.atEnd()) { |
|
1109 QString line = inKcFile.readLine(); |
|
1110 if (line.contains(prefix) && !line.contains(comment)) { |
|
1111 kc.append(clearString(line, prefix, comment)); |
|
1112 } |
|
1113 } |
|
1114 |
|
1115 QVERIFY(qt.size() == kc.size()); |
|
1116 |
|
1117 for(int i = 0; i < kc.size(); i++) { |
|
1118 QString keys = kc.at(i); |
|
1119 QVERIFY(qt.contains(keys)); |
|
1120 } |
|
1121 |
|
1122 for(int i = 0; i < qt.size(); i++) { |
|
1123 QString keys = qt.at(i); |
|
1124 QVERIFY(kc.contains(keys)); |
|
1125 } |
|
1126 } |
|
1127 |
596 |
1128 |
597 //////////////////////////////////////////////////////////////// |
1129 //////////////////////////////////////////////////////////////// |
598 // REQUEST SLOT |
1130 // REQUEST SLOT |
599 //windowGroupAction |
1131 //windowGroupAction |
600 //////////////////////////////////////////////////////////////// |
1132 //////////////////////////////////////////////////////////////// |