Changeset 152708 in webkit
- Timestamp:
- Jul 16, 2013 12:35:49 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r152704 r152708 1 2013-07-16 Dong-Gwan Kim <donggwan.kim@samsung.com> 2 3 Replace mouseClick with more meaningful method in test_ewk2_text_checker.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=118699 5 6 Reviewed by Christophe Dumez. 7 8 Many mouseClick methods are used in test_ewk2_text_checker.cpp. 9 But it is difficult to understand what they mean. 10 So i would like to replace those with more meaningful method for readability. 11 12 * UIProcess/API/efl/tests/test_ewk2_text_checker.cpp: 13 (EWK2TextCheckerTest::clickSelectAllWordsWithSpellcheckButton): 14 (EWK2TextCheckerTest::clickSelectAllWordsWithoutSpellcheckButton): 15 (EWK2TextCheckerTest::clickSelectSubWordWithSpellcheckButton): 16 (EWK2TextCheckerTest::showContextMenuWithFirstLineText): 17 (EWK2TextCheckerTest::showContextMenuWithSecondLineText): 18 (EWK2TextCheckerTest::selectFirstWordInFirstLineText): 19 (EWK2TextCheckerTest::selectFirstWordInSecondLineText): 20 (TEST_F): 21 1 22 2013-07-15 Kangil Han <kangil.han@samsung.com> 2 23 -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp
r152414 r152708 54 54 static unsigned contextMenuItemsNumber = 0; 55 55 static String knownWord; 56 57 class EWK2TextCheckerTest : public EWK2UnitTestBase { 58 protected: 59 enum Line { FirstLine, SecondLine }; 60 enum Button { SelectAllWordsWithSpellcheckButton, SelectAllWordsWithoutSpellcheckButton, SelectSubWordWithSpellcheckButton }; 61 62 void clickButton(Button button) 63 { 64 switch (button) { 65 case SelectAllWordsWithSpellcheckButton: 66 mouseClick(60, 60); 67 break; 68 case SelectAllWordsWithoutSpellcheckButton: 69 mouseClick(500, 60); 70 break; 71 case SelectSubWordWithSpellcheckButton : 72 mouseClick(200, 60); 73 break; 74 } 75 } 76 77 void showContextMenu(Line line) 78 { 79 switch (line) { 80 case FirstLine: 81 mouseClick(10, 20, 3); 82 break; 83 case SecondLine: 84 mouseClick(35, 35, 3); 85 break; 86 } 87 } 88 89 void selectFirstWord(Line line) 90 { 91 switch (line) { 92 case FirstLine: 93 mouseDoubleClick(10, 20); 94 break; 95 case SecondLine: 96 mouseDoubleClick(35, 35); 97 break; 98 } 99 } 100 }; 56 101 57 102 /** … … 354 399 * Test whether there are spelling suggestions when misspelled word is directly context clicked. 355 400 */ 356 TEST_F(EWK2 UnitTestBase, spelling_suggestion_for_context_click)401 TEST_F(EWK2TextCheckerTest, spelling_suggestion_for_context_click) 357 402 { 358 403 wasContextMenuShown = false; … … 361 406 ewkViewClass()->context_menu_show = countContextMenuItems; 362 407 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 363 mouseClick(10, 20, 3 /* Right button - invoke context menu */);408 showContextMenu(FirstLine); 364 409 365 410 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 370 415 // Testing how many items are in context menu when spellcheck is enabled. 371 416 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 372 mouseClick(35, 35, 3 /* Right button - invoke context menu */);417 showContextMenu(SecondLine); 373 418 374 419 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 380 425 * Test whether there are no spelling suggestions when multiple words are selected (that are not a single misspelling). 381 426 */ 382 TEST_F(EWK2 UnitTestBase, no_spelling_suggestion_for_multiword_selection)427 TEST_F(EWK2TextCheckerTest, no_spelling_suggestion_for_multiword_selection) 383 428 { 384 429 wasContextMenuShown = false; … … 387 432 ewkViewClass()->context_menu_show = countContextMenuItems; 388 433 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 389 mouseClick(500, 60, 1 /* Left button - select all words in field without spellcheck */);390 mouseClick(10, 20, 3 /* Right button - invoke context menu */);434 clickButton(SelectAllWordsWithoutSpellcheckButton); 435 showContextMenu(FirstLine); 391 436 392 437 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 397 442 // Testing how many items are in context menu when multiple words are selected. 398 443 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 399 mouseClick(60, 60, 1 /* Left button - select all words in field with spellcheck */);400 mouseClick(35, 35, 3 /* Right button - invoke context menu */);444 clickButton(SelectAllWordsWithSpellcheckButton); 445 showContextMenu(SecondLine); 401 446 402 447 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 408 453 * Test whether there are no spelling suggestions when part of misspelled word are selected. 409 454 */ 410 TEST_F(EWK2 UnitTestBase, no_spelling_suggestion_for_subword_selection)455 TEST_F(EWK2TextCheckerTest, no_spelling_suggestion_for_subword_selection) 411 456 { 412 457 wasContextMenuShown = false; … … 415 460 ewkViewClass()->context_menu_show = countContextMenuItems; 416 461 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 417 mouseClick(500, 60, 1 /* Left button - select all words in field without spellcheck */);418 mouseClick(10, 20, 3 /* Right button - invoke context menu */);462 clickButton(SelectAllWordsWithoutSpellcheckButton); 463 showContextMenu(FirstLine); 419 464 420 465 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 425 470 // Testing how many items are in context menu when part of word is selected. 426 471 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 427 mouseClick(200, 60, 1 /* Left button - select part of word in field with spellcheck */);428 mouseClick(35, 35, 3 /* Right button - invoke context menu */);472 clickButton(SelectSubWordWithSpellcheckButton); 473 showContextMenu(SecondLine); 429 474 430 475 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 436 481 * Test whether context menu spelling items are available when misspelled word has selection as the double click. 437 482 */ 438 TEST_F(EWK2 UnitTestBase, spelling_suggestion_for_double_clicked_word)483 TEST_F(EWK2TextCheckerTest, spelling_suggestion_for_double_clicked_word) 439 484 { 440 485 wasContextMenuShown = false; … … 443 488 ewkViewClass()->context_menu_show = countContextMenuItems; 444 489 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 445 mouseClick(500, 60, 1 /* Left button - select all words in field without spellcheck */);446 mouseClick(10, 20, 3 /* Right button - invoke context menu */);490 clickButton(SelectAllWordsWithoutSpellcheckButton); 491 showContextMenu(FirstLine); 447 492 448 493 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 453 498 // Making double click on misspelled word to select it, and checking are there context menu spell check suggestions. 454 499 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); 455 mouseClick(35, 35, 1 /* Left button - 1st click of doubleclick */); 456 mouseClick(35, 35, 1 /* Left button - 2nd click of doubleclick */); 457 mouseClick(35, 35, 3 /* Right button - invoke context menu */); 500 selectFirstWord(SecondLine); 501 showContextMenu(SecondLine); 458 502 459 503 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); … … 466 510 * continuous spell checking setting. 467 511 */ 468 TEST_F(EWK2 UnitTestBase, ewk_text_checker_spell_checking_languages_get)512 TEST_F(EWK2TextCheckerTest, ewk_text_checker_spell_checking_languages_get) 469 513 { 470 514 ewk_text_checker_continuous_spell_checking_enabled_set(false); … … 503 547 * are available when continuous spell checking is off. 504 548 */ 505 TEST_F(EWK2 UnitTestBase, context_menu_spelling_items_availability)549 TEST_F(EWK2TextCheckerTest, context_menu_spelling_items_availability) 506 550 { 507 551 ewk_text_checker_continuous_spell_checking_enabled_set(false); … … 509 553 510 554 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 511 mouseClick(10, 20, 3 /* Right button */);555 showContextMenu(FirstLine); 512 556 513 557 while (!wasContextMenuShown) … … 520 564 * - ewk_text_checker_continuous_spell_checking_enabled_set 521 565 */ 522 TEST_F(EWK2 UnitTestBase, ewk_text_checker_continuous_spell_checking_enabled)566 TEST_F(EWK2TextCheckerTest, ewk_text_checker_continuous_spell_checking_enabled) 523 567 { 524 568 ewk_text_checker_continuous_spell_checking_enabled_set(true); … … 539 583 * - "Check Spelling While Typing" is disabled. 540 584 */ 541 TEST_F(EWK2 UnitTestBase, ewk_text_checker_check_spelling_while_typing_toggle)585 TEST_F(EWK2TextCheckerTest, ewk_text_checker_check_spelling_while_typing_toggle) 542 586 { 543 587 resetCallbacksExecutionStats(); … … 549 593 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 550 594 551 EWK2UnitTestBase::mouseClick(10, 20, /*Right button*/ 3);595 showContextMenu(FirstLine); 552 596 ASSERT_TRUE(waitUntilTrue(callbacksExecutionStats.settingChange)); 553 597 … … 557 601 isSettingEnabled = !isSettingEnabled; 558 602 559 EWK2UnitTestBase::mouseClick(10, 20, /*Right button*/ 3);603 showContextMenu(FirstLine); 560 604 ASSERT_TRUE(waitUntilTrue(callbacksExecutionStats.settingChange)); 561 605 … … 566 610 * Test whether the onSettingChange callback is not called when the spell checking setting was changed by client. 567 611 */ 568 TEST_F(EWK2 UnitTestBase, ewk_text_checker_continuous_spell_checking_change_cb_set)612 TEST_F(EWK2TextCheckerTest, ewk_text_checker_continuous_spell_checking_change_cb_set) 569 613 { 570 614 resetCallbacksExecutionStats(); … … 588 632 * "Check Spelling While Typing" option is toggled in context menu. 589 633 */ 590 TEST_F(EWK2 UnitTestBase, ewk_text_checker_continuous_spell_checking_change_cb_unset)634 TEST_F(EWK2TextCheckerTest, ewk_text_checker_continuous_spell_checking_change_cb_unset) 591 635 { 592 636 resetCallbacksExecutionStats(); … … 595 639 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 596 640 597 EWK2UnitTestBase::mouseClick(10, 20, /*Right button*/ 3);641 showContextMenu(FirstLine); 598 642 ASSERT_FALSE(waitUntilTrue(callbacksExecutionStats.settingChange, /*Timeout*/ 0)); 599 643 } … … 604 648 * All the dictionaries from the list can be set to perform spellchecking. 605 649 */ 606 TEST_F(EWK2 UnitTestBase, ewk_text_checker_spell_checking_available_languages_get)650 TEST_F(EWK2TextCheckerTest, ewk_text_checker_spell_checking_available_languages_get) 607 651 { 608 652 Eina_List* availableLanguages = ewk_text_checker_spell_checking_available_languages_get(); … … 656 700 * - if two arbitrarily selected dictionaries are set correctly. 657 701 */ 658 TEST_F(EWK2 UnitTestBase, ewk_text_checker_spell_checking_languages)702 TEST_F(EWK2TextCheckerTest, ewk_text_checker_spell_checking_languages) 659 703 { 660 704 // Set the default language. … … 717 761 * Test whether the client's callbacks aren't called (if not specified). 718 762 */ 719 TEST_F(EWK2 UnitTestBase, ewk_text_checker)763 TEST_F(EWK2TextCheckerTest, ewk_text_checker) 720 764 { 721 765 resetCallbacksExecutionStats(); … … 738 782 * Test whether the client's callbacks (onSpellDocumentTag, onSpellDocumentTagClose) are called. 739 783 */ 740 TEST_F(EWK2 UnitTestBase, ewk_text_checker_unique_spell_document_tag)784 TEST_F(EWK2TextCheckerTest, ewk_text_checker_unique_spell_document_tag) 741 785 { 742 786 resetCallbacksExecutionStats(); … … 760 804 * the word to input field was put. 761 805 */ 762 TEST_F(EWK2 UnitTestBase, ewk_text_checker_string_spelling_check_cb_set)806 TEST_F(EWK2TextCheckerTest, ewk_text_checker_string_spelling_check_cb_set) 763 807 { 764 808 resetCallbacksExecutionStats(); … … 778 822 * the context menu was shown on the misspelled word. 779 823 */ 780 TEST_F(EWK2 UnitTestBase, ewk_text_checker_word_guesses_get_cb_set)824 TEST_F(EWK2TextCheckerTest, ewk_text_checker_word_guesses_get_cb_set) 781 825 { 782 826 resetCallbacksExecutionStats(); … … 788 832 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 789 833 790 EWK2UnitTestBase::mouseClick(10, 20, /*Right button*/ 3);834 showContextMenu(FirstLine); 791 835 ASSERT_TRUE(waitUntilTrue(wasContextMenuShown)); 792 836 … … 802 846 * check whether the learned word is treated as spelled correctly while spell checking. 803 847 */ 804 TEST_F(EWK2 UnitTestBase, ewk_text_checker_word_learn_cb_set)848 TEST_F(EWK2TextCheckerTest, ewk_text_checker_word_learn_cb_set) 805 849 { 806 850 resetCallbacksExecutionStats(); … … 811 855 812 856 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 813 mouseDoubleClick(10, 20);814 mouseClick(10, 20, 3 /* Right button - invoke context menu */);857 selectFirstWord(FirstLine); 858 showContextMenu(FirstLine); 815 859 816 860 ASSERT_TRUE(waitUntilTrue(callbacksExecutionStats.wordLearn)); … … 834 878 * check whether the ignored word is treated as spelled correctly while spell checking. 835 879 */ 836 TEST_F(EWK2 UnitTestBase, ewk_text_checker_word_ignore_cb_set)880 TEST_F(EWK2TextCheckerTest, ewk_text_checker_word_ignore_cb_set) 837 881 { 838 882 resetCallbacksExecutionStats(); … … 843 887 844 888 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 845 mouseDoubleClick(10, 20);846 mouseClick(10, 20, 3 /* Right button - invoke context menu */);889 selectFirstWord(FirstLine); 890 showContextMenu(FirstLine); 847 891 848 892 ASSERT_TRUE(waitUntilTrue(callbacksExecutionStats.wordIgnore));
Note: See TracChangeset
for help on using the changeset viewer.