Title: [152758] trunk/Source/WebKit2
Revision
152758
Author
[email protected]
Date
2013-07-17 00:03:48 -0700 (Wed, 17 Jul 2013)

Log Message

[EFL][WK2] EWK2ColorPickerTest should be defined by inheriting from EWK2UnitTestBase.
https://bugs.webkit.org/show_bug.cgi?id=118762

Patch by Dong-Gwan Kim <[email protected]> on 2013-07-17
Reviewed by Christophe Dumez.

It should be defined as relevant test class specific to each test file for more readability.
It could be helpful to remove unnecessary static methods.

* UIProcess/API/efl/tests/test_ewk2_color_picker.cpp:
(EWK2ColorPickerTest::onColorPickerDone):
(EWK2ColorPickerTest::setColorPickerColor):
(EWK2ColorPickerTest::showColorPicker):
(EWK2ColorPickerTest::hideColorPicker):
(EWK2ColorPickerTest::hideColorPickerByRemovingElement):
(TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (152757 => 152758)


--- trunk/Source/WebKit2/ChangeLog	2013-07-17 06:43:07 UTC (rev 152757)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-17 07:03:48 UTC (rev 152758)
@@ -1,3 +1,21 @@
+2013-07-17  Dong-Gwan Kim  <[email protected]>
+
+        [EFL][WK2] EWK2ColorPickerTest should be defined by inheriting from EWK2UnitTestBase.
+        https://bugs.webkit.org/show_bug.cgi?id=118762
+
+        Reviewed by Christophe Dumez.
+
+        It should be defined as relevant test class specific to each test file for more readability.
+        It could be helpful to remove unnecessary static methods.
+
+        * UIProcess/API/efl/tests/test_ewk2_color_picker.cpp:
+        (EWK2ColorPickerTest::onColorPickerDone):
+        (EWK2ColorPickerTest::setColorPickerColor):
+        (EWK2ColorPickerTest::showColorPicker):
+        (EWK2ColorPickerTest::hideColorPicker):
+        (EWK2ColorPickerTest::hideColorPickerByRemovingElement):
+        (TEST_F):
+
 2013-07-16  Gordon Sheridan  <[email protected]>
 
         setPluginUnavailabilityReason can destroy renderObject before obscurity check

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp (152757 => 152758)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp	2013-07-17 06:43:07 UTC (rev 152757)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp	2013-07-17 07:03:48 UTC (rev 152758)
@@ -38,77 +38,79 @@
 static bool s_isColorPickerShown = false;
 static Ewk_Color_Picker* s_colorPicker = 0;
 
+class EWK2ColorPickerTest : public EWK2UnitTestBase {
+public:
+    static void onColorPickerDone(void* userData, Evas_Object*, void*)
+    {
+        bool* handled = static_cast<bool*>(userData);
 
-static void onColorPickerDone(void* userData, Evas_Object*, void*)
-{
-    bool* handled = static_cast<bool*>(userData);
+        *handled = true;
+    }
 
-    *handled = true;
-}
+    static unsigned char setColorPickerColor(void* data)
+    {
+        Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
 
-static unsigned char setColorPickerColor(void* data)
-{
-    Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
+        // 4. Change color to changed color.
+        EXPECT_TRUE(ewk_color_picker_color_set(s_colorPicker, changedRed, changedGreen, changedBlue, changedAlpha));
 
-    // 4. Change color to changed color.
-    EXPECT_TRUE(ewk_color_picker_color_set(s_colorPicker, changedRed, changedGreen, changedBlue, changedAlpha));
+        evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0);
 
-    evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0);
+        return 0;
+    }
 
-    return 0;
-}
+    static Eina_Bool showColorPicker(Ewk_View_Smart_Data* smartData, Ewk_Color_Picker* colorPicker)
+    {
+        static bool isFirstRun = true;
 
-static Eina_Bool showColorPicker(Ewk_View_Smart_Data* smartData, Ewk_Color_Picker* colorPicker)
-{
-    static bool isFirstRun = true;
+        s_colorPicker = colorPicker;
+        s_isColorPickerShown = true;
 
-    s_colorPicker = colorPicker;
-    s_isColorPickerShown = true;
+        int r, g, b, a;
+        EXPECT_TRUE(ewk_color_picker_color_get(colorPicker, &r, &g, &b, &a));
 
-    int r, g, b, a;
-    EXPECT_TRUE(ewk_color_picker_color_get(colorPicker, &r, &g, &b, &a));
+        if (isFirstRun) {
+            // 2. Check initial value from html file.
+            EXPECT_EQ(initialRed, r);
+            EXPECT_EQ(initialGreen, g);
+            EXPECT_EQ(initialBlue, b);
+            EXPECT_EQ(initialAlpha, a);
 
-    if (isFirstRun) {
-        // 2. Check initial value from html file.
-        EXPECT_EQ(initialRed, r);
-        EXPECT_EQ(initialGreen, g);
-        EXPECT_EQ(initialBlue, b);
-        EXPECT_EQ(initialAlpha, a);
+            isFirstRun = false;
+        } else {
+            // 7. Input values should be same as changed color.
+            EXPECT_EQ(changedRed, r);
+            EXPECT_EQ(changedGreen, g);
+            EXPECT_EQ(changedBlue, b);
+            EXPECT_EQ(changedAlpha, a);
 
-        isFirstRun = false;
-    } else {
-        // 7. Input values should be same as changed color.
-        EXPECT_EQ(changedRed, r);
-        EXPECT_EQ(changedGreen, g);
-        EXPECT_EQ(changedBlue, b);
-        EXPECT_EQ(changedAlpha, a);
+            evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0);
+            return true;
+        }
 
-        evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0);
+        // 3. Return after making a color picker.
+        ecore_timer_add(0.0, setColorPickerColor, smartData);
         return true;
     }
 
-    // 3. Return after making a color picker.
-    ecore_timer_add(0.0, setColorPickerColor, smartData);
-    return true;
-}
+    static Eina_Bool hideColorPicker(Ewk_View_Smart_Data*)
+    {
+        // 5. Test color picker is shown.
+        EXPECT_TRUE(s_isColorPickerShown);
+        s_isColorPickerShown = false;
+    }
 
-static Eina_Bool hideColorPicker(Ewk_View_Smart_Data*)
-{
-    // 5. Test color picker is shown.
-    EXPECT_TRUE(s_isColorPickerShown);
-    s_isColorPickerShown = false;
-}
+    static Eina_Bool hideColorPickerByRemovingElement(Ewk_View_Smart_Data* smartData)
+    {
+        // 9. input_picker_color_dismiss() is called if the element is removed.
+        EXPECT_TRUE(s_isColorPickerShown);
+        s_isColorPickerShown = false;
+        evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0);
+    }
+};
 
-static Eina_Bool hideColorPickerByRemovingElement(Ewk_View_Smart_Data* smartData)
+TEST_F(EWK2ColorPickerTest, ewk_color_picker_color_set)
 {
-    // 9. input_picker_color_dismiss() is called if the element is removed.
-    EXPECT_TRUE(s_isColorPickerShown);
-    s_isColorPickerShown = false;
-    evas_object_smart_callback_call(smartData->self, "input,type,color,request", 0);
-}
-
-TEST_F(EWK2UnitTestBase, ewk_color_picker_color_set)
-{
     Ewk_View_Smart_Class* api = ewkViewClass();
     api->input_picker_color_request = showColorPicker;
     api->input_picker_color_dismiss = hideColorPicker;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to