Changeset 152414 in webkit
- Timestamp:
- Jul 5, 2013 3:29:12 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r152412 r152414 1 2013-07-05 Krzysztof Wolanski <k.wolanski@samsung.com> 2 3 [EFL][WK2] Implement unit test callbacks: onWordLearn and onWordIgnore. 4 https://bugs.webkit.org/show_bug.cgi?id=118392 5 6 Reviewed by Christophe Dumez. 7 8 Simulate behavior of Learn and Ignore Word in the text field. 9 10 * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp: 11 (EWK2UnitTest::EWK2UnitTestBase::mouseDoubleClick): 12 Select the entire word in the text field. 13 14 * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h: 15 * UIProcess/API/efl/tests/test_ewk2_text_checker.cpp: 16 (onSpellingForKnownWord): 17 (onWordLearn): 18 (onWordIgnore): 19 (selectLearnSpelling): 20 (selectIgnoreSpelling): 21 1 22 2013-07-05 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 23 -
trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
r151433 r152414 244 244 } 245 245 246 void EWK2UnitTestBase::mouseDoubleClick(int x, int y, int button) 247 { 248 Evas* evas = evas_object_evas_get(m_webView); 249 evas_event_feed_mouse_move(evas, x, y, 0, 0); 250 evas_event_feed_mouse_down(evas, button, EVAS_BUTTON_DOUBLE_CLICK, 0, 0); 251 evas_event_feed_mouse_up(evas, button, EVAS_BUTTON_NONE, 0, 0); 252 } 253 246 254 void EWK2UnitTestBase::mouseDown(int x, int y, int button) 247 255 { -
trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
r151428 r152414 54 54 55 55 void mouseClick(int x, int y, int button = 1 /*Left*/); 56 void mouseDoubleClick(int x, int y, int button = 1 /*Left*/); 56 57 void mouseDown(int x, int y, int button = 1 /*Left*/); 57 58 void mouseUp(int x, int y, int button = 1 /*Left*/); -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp
r152153 r152414 53 53 static const char* clientSuggestionsForWord[] = { "clientSuggestion1", "clientSuggestion2", "clientSuggestion3" }; 54 54 static unsigned contextMenuItemsNumber = 0; 55 static String knownWord; 55 56 56 57 /** … … 169 170 170 171 /** 172 * Checks spelling for the given @a text and compares it with the knownWord. 173 * 174 * @internal 175 * 176 * @param text the text containing the words to spellcheck 177 * @param misspelling_location a pointer to store the beginning of the misspelled @a text, @c -1 if the @a text is correct 178 * @param misspelling_length a pointer to store the length of misspelled @a text, @c 0 if the @a text is correct 179 */ 180 static void onSpellingForKnownWord(uint64_t, const char* text, int32_t* misspellingLocation, int32_t* misspellingLength) 181 { 182 ASSERT_STREQ(knownWord.utf8().data(), text); 183 184 ASSERT_TRUE(misspellingLocation); 185 ASSERT_TRUE(misspellingLength); 186 187 *misspellingLocation = -1; 188 *misspellingLength = 0; 189 190 callbacksExecutionStats.spellingCheck = true; 191 } 192 193 /** 171 194 * Gets a list of suggested spellings for a misspelled @a word. 172 195 * … … 204 227 ASSERT_EQ(defaultDocumentTag, tag); 205 228 ASSERT_STREQ(expectedMisspelledWord, word); 229 knownWord = word; 206 230 callbacksExecutionStats.wordLearn = true; 207 231 } … … 219 243 ASSERT_EQ(defaultDocumentTag, tag); 220 244 ASSERT_STREQ(expectedMisspelledWord, word); 245 knownWord = word; 221 246 callbacksExecutionStats.wordIgnore = true; 222 247 } … … 306 331 } 307 332 333 static Eina_Bool selectLearnSpelling(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu) 334 { 335 return ewk_context_menu_item_select(contextMenu, findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, EWK_ACTION_TYPE)); 336 } 337 338 static Eina_Bool selectIgnoreSpelling(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu) 339 { 340 return ewk_context_menu_item_select(contextMenu, findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, EWK_ACTION_TYPE)); 341 } 342 308 343 /** 309 344 * Count number of elements in context menu. … … 764 799 /** 765 800 * Test whether the client's callback (onWordLearn) is called when 766 * the context menu option "Learn spelling" was choosen. 801 * the context menu option "Learn spelling" was chosen. In the next step, 802 * check whether the learned word is treated as spelled correctly while spell checking. 767 803 */ 768 804 TEST_F(EWK2UnitTestBase, ewk_text_checker_word_learn_cb_set) 769 805 { 770 806 resetCallbacksExecutionStats(); 807 knownWord = emptyString(); 771 808 defaultView = webView(); 772 ewk_text_checker_continuous_spell_checking_enabled_set(true);773 774 809 ewk_text_checker_word_learn_cb_set(onWordLearn); 775 776 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 777 778 /* FIXME: 779 1) Invoke the context menu on the misspelled word (not implemented for WK2), 780 the word has to be selected first. 781 2) Check whether the callback was called. */ 810 ewkViewClass()->context_menu_show = selectLearnSpelling; 811 812 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 813 mouseDoubleClick(10, 20); 814 mouseClick(10, 20, 3 /* Right button - invoke context menu */); 815 816 ASSERT_TRUE(waitUntilTrue(callbacksExecutionStats.wordLearn)); 817 818 // Open html again and check whether the learned word 819 // is treated as spelled correctly while spell checking. 820 resetCallbacksExecutionStats(); 821 ewk_text_checker_string_spelling_check_cb_set(onSpellingForKnownWord); 822 823 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 824 825 ASSERT_TRUE(callbacksExecutionStats.spellingCheck); 826 827 ewk_text_checker_string_spelling_check_cb_set(0); 828 ewk_text_checker_word_learn_cb_set(0); 782 829 } 783 830 784 831 /** 785 832 * Test whether the client's callback (onWordIgnore) is called when 786 * the context menu option "Ignore spelling" was choosen. 833 * the context menu option "Ignore spelling" was chosen. In the next step, 834 * check whether the ignored word is treated as spelled correctly while spell checking. 787 835 */ 788 836 TEST_F(EWK2UnitTestBase, ewk_text_checker_word_ignore_cb_set) 789 837 { 790 838 resetCallbacksExecutionStats(); 839 knownWord = emptyString(); 791 840 defaultView = webView(); 792 ewk_text_checker_continuous_spell_checking_enabled_set(true);793 794 841 ewk_text_checker_word_ignore_cb_set(onWordIgnore); 795 796 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 797 798 /* FIXME: 799 1) Invoke the context menu on the misspelled word (not implemented for WK2), 800 the word has to be selected first. 801 2) Check whether the callback was called. */ 802 } 842 ewkViewClass()->context_menu_show = selectIgnoreSpelling; 843 844 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 845 mouseDoubleClick(10, 20); 846 mouseClick(10, 20, 3 /* Right button - invoke context menu */); 847 848 ASSERT_TRUE(waitUntilTrue(callbacksExecutionStats.wordIgnore)); 849 850 // Open html again and check whether the ignored word 851 // is treated as spelled correctly while spell checking. 852 resetCallbacksExecutionStats(); 853 ewk_text_checker_string_spelling_check_cb_set(onSpellingForKnownWord); 854 855 ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data())); 856 857 ASSERT_TRUE(callbacksExecutionStats.spellingCheck); 858 859 ewk_text_checker_string_spelling_check_cb_set(0); 860 ewk_text_checker_word_ignore_cb_set(0); 861 }
Note: See TracChangeset
for help on using the changeset viewer.