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;