Modified: trunk/Source/WebKit2/ChangeLog (153418 => 153419)
--- trunk/Source/WebKit2/ChangeLog 2013-07-29 06:23:55 UTC (rev 153418)
+++ trunk/Source/WebKit2/ChangeLog 2013-07-29 07:17:01 UTC (rev 153419)
@@ -1,3 +1,30 @@
+2013-07-28 Grzegorz Czajkowski <[email protected]>
+
+ [EFL][WK2] Simplify context_menu_spelling_items_availability unit test
+ https://bugs.webkit.org/show_bug.cgi?id=119085
+
+ Reviewed by Gyuyoung Kim.
+
+ Use findContextMenuItem method to check whether the item
+ appears in context menu.
+
+ * UIProcess/API/efl/tests/test_ewk2_text_checker.cpp:
+ (EWK2TextCheckerTest::findContextMenuItem):
+ Do not report failure inside the method.
+ It doesn't allow to test the negative test cases.
+
+ (EWK2TextCheckerTest::checkCorrectnessOfSpellingItems):
+ Use findContextMenuItem method.
+
+ (EWK2TextCheckerTest::toogleCheckSpellingWhileTyping):
+ (EWK2TextCheckerTest::selectLearnSpelling):
+ (EWK2TextCheckerTest::selectIgnoreSpelling):
+ Verify the return value of findContextMenuItem.
+
+ (TEST_F):
+ Reset wasContextMenuShown variable, it's needed after r152153.
+ Use waitUntilTrue method.
+
2013-07-27 Jacky Jiang <[email protected]>
Replace all uses of GraphicsLayer::create function with the one that takes a GraphicsLayerFactory
Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp (153418 => 153419)
--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp 2013-07-29 06:23:55 UTC (rev 153418)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp 2013-07-29 07:17:01 UTC (rev 153419)
@@ -46,9 +46,6 @@
static double defaultTimeoutInSeconds = 0.5;
static bool wasContextMenuShown = false;
-static const char noGuessesString[] = "No Guesses Found";
-static const char ignoreSpellingString[] = "Ignore Spelling";
-static const char learnSpellingString[] = "Learn Spelling";
static const char* clientSuggestionsForWord[] = { "clientSuggestion1", "clientSuggestion2", "clientSuggestion3" };
static unsigned contextMenuItemsNumber = 0;
@@ -270,34 +267,20 @@
return item;
}
- ADD_FAILURE();
return 0;
}
static Eina_Bool checkCorrectnessOfSpellingItems(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
{
- const Eina_List* contextMenuItems = ewk_context_menu_items_get(contextMenu);
+ Ewk_Context_Menu_Item* noGuessesItem = findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND, EWK_ACTION_TYPE);
+ EXPECT_FALSE(noGuessesItem);
- bool noGuessesAvailable = false;
- bool isIgnoreSpellingAvailable = false;
- bool isLearnSpellingAvailable = false;
+ Ewk_Context_Menu_Item* ignoreSpellingItem = findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, EWK_ACTION_TYPE);
+ EXPECT_TRUE(ignoreSpellingItem);
- const Eina_List* listIterator;
- void* itemData;
- EINA_LIST_FOREACH(contextMenuItems, listIterator, itemData) {
- Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(itemData);
- if (!strcmp(ewk_context_menu_item_title_get(item), noGuessesString))
- noGuessesAvailable = true;
- else if (!strcmp(ewk_context_menu_item_title_get(item), ignoreSpellingString))
- isIgnoreSpellingAvailable = true;
- else if (!strcmp(ewk_context_menu_item_title_get(item), learnSpellingString))
- isLearnSpellingAvailable = true;
- }
+ Ewk_Context_Menu_Item* learnSpellingItem = findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, EWK_ACTION_TYPE);
+ EXPECT_TRUE(learnSpellingItem);
- EXPECT_FALSE(noGuessesAvailable);
- EXPECT_TRUE(isIgnoreSpellingAvailable);
- EXPECT_TRUE(isLearnSpellingAvailable);
-
wasContextMenuShown = true;
return true;
}
@@ -305,8 +288,11 @@
static Eina_Bool toogleCheckSpellingWhileTyping(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
{
Ewk_Context_Menu_Item* spellingAndGrammarItem = findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, EWK_SUBMENU_TYPE);
+ EXPECT_TRUE(spellingAndGrammarItem);
+
Ewk_Context_Menu* spellingAndGrammarSubmenu = ewk_context_menu_item_submenu_get(spellingAndGrammarItem);
Ewk_Context_Menu_Item* checkSpellingWhileTypingItem = findContextMenuItem(spellingAndGrammarSubmenu, EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING, EWK_CHECKABLE_ACTION_TYPE);
+ EXPECT_TRUE(checkSpellingWhileTypingItem);
return ewk_context_menu_item_select(spellingAndGrammarSubmenu, checkSpellingWhileTypingItem);
}
@@ -334,12 +320,18 @@
static Eina_Bool selectLearnSpelling(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
{
- return ewk_context_menu_item_select(contextMenu, findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, EWK_ACTION_TYPE));
+ Ewk_Context_Menu_Item* learnSpellingItem = findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, EWK_ACTION_TYPE);
+ EXPECT_TRUE(learnSpellingItem);
+
+ return ewk_context_menu_item_select(contextMenu, learnSpellingItem);
}
static Eina_Bool selectIgnoreSpelling(Ewk_View_Smart_Data*, Evas_Coord, Evas_Coord, Ewk_Context_Menu* contextMenu)
{
- return ewk_context_menu_item_select(contextMenu, findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, EWK_ACTION_TYPE));
+ Ewk_Context_Menu_Item* ignoreSpellingItem = findContextMenuItem(contextMenu, EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, EWK_ACTION_TYPE);
+ EXPECT_TRUE(ignoreSpellingItem);
+
+ return ewk_context_menu_item_select(contextMenu, ignoreSpellingItem);
}
/**
@@ -549,14 +541,15 @@
*/
TEST_F(EWK2TextCheckerTest, context_menu_spelling_items_availability)
{
+ wasContextMenuShown = false;
+
ewk_text_checker_continuous_spell_checking_enabled_set(false);
ewkViewClass()->context_menu_show = checkCorrectnessOfSpellingItems;
ASSERT_TRUE(loadUrlSync(environment->urlForResource("spelling_test.html").data()));
showContextMenu(FirstLine);
- while (!wasContextMenuShown)
- ecore_main_loop_iterate();
+ ASSERT_TRUE(waitUntilTrue(wasContextMenuShown));
}
/**