WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proposed patch
patch.diff (text/plain), 9.45 KB, created by
Dariusz Frankiewicz
on 2013-06-27 03:34:52 PDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Dariusz Frankiewicz
Created:
2013-06-27 03:34:52 PDT
Size:
9.45 KB
patch
obsolete
>diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index 8a46603..6f30d76 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,22 @@ >+2013-06-26 Dariusz Frankiewicz <d.frankiewic@samsung.com> >+ >+ Porting spellcheck tests from layout tests to unit tests. >+ https://bugs.webkit.org/show_bug.cgi?id=118123 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ According to discussion in bug https://bugs.webkit.org/show_bug.cgi?id=113742 >+ we're moving spelling tests from layout tests to unit tests. >+ >+ * UIProcess/API/efl/tests/resources/spelling_selection_tests.html: Added. >+ New file is needed to make tests, with and without spellcheck attribute. >+ File contains basic site with content editable fields and buttons which select >+ different parts of misspelled words. >+ >+ * UIProcess/API/efl/tests/test_ewk2_text_checker.cpp: >+ (countContextMenuItems): >+ Added method used to count number of items in context menu. >+ > 2013-06-24 Simon Cooper <scooper@apple.com> > > Silverlight triggers sandbox violations: deny network-bind 0.0.0.0:0 >diff --git a/Source/WebKit2/UIProcess/API/efl/tests/resources/spelling_selection_tests.html b/Source/WebKit2/UIProcess/API/efl/tests/resources/spelling_selection_tests.html >new file mode 100644 >index 0000000..635eebd >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/efl/tests/resources/spelling_selection_tests.html >@@ -0,0 +1,46 @@ >+<!-- >+ The page contains elements used to check context menu spelling suggestions. >+ There are also available functions which select specific part of misspelled word/sentence. >+--> >+<html> >+<head> >+ <title>Testing selection for Spelling</title> >+ <script> >+ // Select all text inside element. >+ function selectText(element) >+ { >+ var text = document.getElementById(element); >+ var selection = window.getSelection(); >+ var range = document.createRange(); >+ range.selectNodeContents(text); >+ selection.removeAllRanges(); >+ selection.addRange(range); >+ } >+ >+ // Select part of text inside element. >+ function selectSubText(element) >+ { >+ var text = document.getElementById(element); >+ var startNode = text.firstChild; >+ var endNode = text.firstChild; >+ var range = document.createRange(); >+ range.setStart(startNode, 2); >+ range.setEnd(endNode, 6); >+ // Select "llco" from Wellcome word. >+ var selection = window.getSelection(); >+ selection.removeAllRanges(); >+ selection.addRange(range); >+ } >+ </script> >+</head> >+ >+<body> >+ <!-- element used to count context menu items, without spellcheck suggestions --> >+ <div contenteditable="true" id="elementWithoutSpellcheck" spellcheck="false">Wellcome home</div> >+ <div contenteditable="true" id="elementWithSpellcheck" spellcheck="true">Wellcome home</div> >+ >+ <button onclick="selectText('elementWithSpellcheck')">Select all words</button> >+ <button onclick="selectSubText('elementWithSpellcheck')">Select sub word</button> >+ <button onclick="selectText('elementWithoutSpellcheck')">Select all words in field without spellcheck</button> >+</body> >+</html> >diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp >index 3013aa8..a07911c 100644 >--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp >@@ -51,6 +51,7 @@ static const char ignoreSpellingString[] = "Ignore Spelling"; > static const char learnSpellingString[] = "Learn Spelling"; > > static const char* clientSuggestionsForWord[] = { "clientSuggestion1", "clientSuggestion2", "clientSuggestion3" }; >+static size_t contextMenuItemsNumber = 0; > > /** > * Structure keeps information which callbacks were called. >@@ -305,6 +306,131 @@ static Eina_Bool checkClientSuggestionsForWord(Ewk_View_Smart_Data*, Evas_Coord, > } > > /** >+ * Count number of elements in context menu. >+ */ >+static Eina_Bool countContextMenuItems(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu) >+{ >+ contextMenuItemsNumber = eina_list_count(ewk_context_menu_items_get(contextMenu)); >+ wasContextMenuShown = true; >+ return true; >+} >+ >+/** >+ * Test whether there is spelling suggestions when misspelled word is directly context clicked. >+ */ >+TEST_F(EWK2UnitTestBase, spelling_suggestion_for_context_click) >+{ >+ // Checking number of context menu items when element has no spellcheck suggestions. >+ ewkViewClass()->context_menu_show = countContextMenuItems; >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(10, 20, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithoutSpellCheck = contextMenuItemsNumber; >+ >+ wasContextMenuShown = false; >+ >+ // Testing how many items are in context menu when spellcheck is enabled. >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(35, 35, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithSpellCheck = contextMenuItemsNumber; >+ >+ EXPECT_LT(numberItemsWithoutSpellCheck, numberItemsWithSpellCheck); >+ >+ wasContextMenuShown = false; >+} >+ >+/** >+ * Test whether there is no spelling suggestions when multiple words are selected (that are not a single misspelling). >+ */ >+TEST_F(EWK2UnitTestBase, no_spelling_suggestion_for_multiword_selection) >+{ >+ // Checking number of context menu items when element has no spellcheck suggestions. >+ ewkViewClass()->context_menu_show = countContextMenuItems; >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(500, 60, 1 /* Left button - select all words in field without spellcheck */); >+ mouseClick(10, 20, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithoutSpellCheck = contextMenuItemsNumber; >+ >+ wasContextMenuShown = false; >+ >+ // Testing how many items are in context menu when multiword are selected. >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(60, 60, 1 /* Left button - select all words in field with spellcheck */); >+ mouseClick(35, 35, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithSpellCheck = contextMenuItemsNumber; >+ >+ EXPECT_EQ(numberItemsWithoutSpellCheck, numberItemsWithSpellCheck); >+ >+ wasContextMenuShown = false; >+} >+ >+/** >+ * Test whether there is no spelling suggestions when part of misspelled word are selected. >+ */ >+TEST_F(EWK2UnitTestBase, no_spelling_suggestion_for_subword_selection) >+{ >+ // Checking number of context menu items when element has no spellcheck suggestions. >+ ewkViewClass()->context_menu_show = countContextMenuItems; >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(500, 60, 1 /* Left button - select all words in field without spellcheck */); >+ mouseClick(10, 20, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithoutSpellCheck = contextMenuItemsNumber; >+ >+ wasContextMenuShown = false; >+ >+ // Testing how many items are in context menu when part of word is selected. >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(200, 60, 1 /* Left button - select part of word in field with spellcheck */); >+ mouseClick(35, 35, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithSpellCheck = contextMenuItemsNumber; >+ >+ EXPECT_EQ(numberItemsWithoutSpellCheck, numberItemsWithSpellCheck); >+ >+ wasContextMenuShown = false; >+} >+ >+/** >+ * Test whether context menu spelling items are available when misspelled word has selection as the double click. >+ */ >+TEST_F(EWK2UnitTestBase, spelling_suggestion_for_double_clicked_word) >+{ >+ // Checking number of context menu items when element has no spell check suggestions. >+ ewkViewClass()->context_menu_show = countContextMenuItems; >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(500, 60, 1 /* Left button - select all words in field without spellcheck */); >+ mouseClick(10, 20, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithoutSpellCheck = contextMenuItemsNumber; >+ >+ wasContextMenuShown = false; >+ >+ // Making double click on misspelled word to select it, and checking are there context menu spell check suggestions. >+ ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_selection_tests.html").data())); >+ mouseClick(35, 35, 1 /* Left button - 1st click of doubleclick */); >+ mouseClick(35, 35, 1 /* Left button - 2nd click of doubleclick */); >+ mouseClick(35, 35, 3 /* Right button - invoke context menu */); >+ >+ waitUntilTrue(wasContextMenuShown); >+ size_t numberItemsWithSpellCheck = contextMenuItemsNumber; >+ >+ EXPECT_LT(numberItemsWithoutSpellCheck, numberItemsWithSpellCheck); >+ >+ wasContextMenuShown = false; >+} >+ >+/** > * Test whether the default language is loaded independently of > * continuous spell checking setting. > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
cdumez
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 118123
:
205583
|
205592
|
205594
|
205603
|
205623