[EFL][WK2] TestRunner needs touch events support.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 00:54:11 +0000 (00:54 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2012 00:54:11 +0000 (00:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96465

Patch by Nikhil Bansal <n.bansal@samsung.com> on 2012-09-24
Reviewed by Kenneth Rohde Christiansen.

Tools:

Simulate touch events in WebkitTestRunner for touch related
layout tests. This patch uses ewk_view_feed_touch_event() to
generate touch events.

* WebKitTestRunner/EventSenderProxy.h:
(EventSenderProxy):
* WebKitTestRunner/efl/EventSenderProxyEfl.cpp:
(WTR):
(WTR::setEvasModifiers):
(WTR::EventSenderProxy::EventSenderProxy):
(WTR::EventSenderProxy::~EventSenderProxy):
(WTR::EventSenderProxy::sendTouchEvent):
(WTR::EventSenderProxy::addTouchPoint):
(WTR::EventSenderProxy::updateTouchPoint):
(WTR::EventSenderProxy::setTouchModifier):
(WTR::EventSenderProxy::touchStart):
(WTR::EventSenderProxy::touchMove):
(WTR::EventSenderProxy::touchEnd):
(WTR::EventSenderProxy::touchCancel):
(WTR::EventSenderProxy::clearTouchPoints):
(WTR::EventSenderProxy::releaseTouchPoint):
(WTR::EventSenderProxy::cancelTouchPoint):

LayoutTests:

Touch events support added in WebKitTestRunner for layout tests.

* platform/efl-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/efl-wk2/TestExpectations
Tools/ChangeLog
Tools/WebKitTestRunner/EventSenderProxy.h
Tools/WebKitTestRunner/efl/EventSenderProxyEfl.cpp

index 083d743..599541a 100644 (file)
@@ -1,3 +1,14 @@
+2012-09-24  Nikhil Bansal  <n.bansal@samsung.com>
+
+        [EFL][WK2] TestRunner needs touch events support.
+        https://bugs.webkit.org/show_bug.cgi?id=96465
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Touch events support added in WebKitTestRunner for layout tests.
+
+        * platform/efl-wk2/TestExpectations:
+
 2012-09-24  Filip Pizlo  <fpizlo@apple.com>
 
         ValueToInt32 bool case does bad things to registers
index dc9d826..993ffce 100644 (file)
@@ -159,21 +159,8 @@ webkit.org/b/42674 http/tests/navigation/response204.html [ Failure ]
 webkit.org/b/93470 fast/dom/title-directionality-removeChild.html [ Failure ]
 webkit.org/b/93470 fast/dom/title-directionality.html [ Failure ]
 
-# WebKitTestRunner eventSender needs touch events support
-webkit.org/b/96465 fast/events/touch/basic-multi-touch-events-limited.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/basic-multi-touch-events.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/basic-single-touch-events.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/multi-touch-grouped-targets.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/send-oncancel-event.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/tap-highlight-color.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-active-state.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-coords-in-zoom-and-scroll.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-inside-iframe.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-inside-iframe-scrolled.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-slider.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-stale-node-crash.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-target-limited.html [ Failure ]
-webkit.org/b/96465 fast/events/touch/touch-target.html [ Failure ]
+# WebKitTestRunner setTouchPointRadius() is not supported
+Bug(EFL) fast/events/touch/basic-single-touch-events.html [ Failure ]
 
 # WebKitTestRunner needs an implementation for testRunner.setViewModeMediaFeature
 Bug(EFL) fast/media/media-query-list-02.html [ Failure ]
index c75c979..327de01 100644 (file)
@@ -1,3 +1,33 @@
+2012-09-24  Nikhil Bansal  <n.bansal@samsung.com>
+
+        [EFL][WK2] TestRunner needs touch events support.
+        https://bugs.webkit.org/show_bug.cgi?id=96465
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Simulate touch events in WebkitTestRunner for touch related
+        layout tests. This patch uses ewk_view_feed_touch_event() to
+        generate touch events.
+
+        * WebKitTestRunner/EventSenderProxy.h:
+        (EventSenderProxy):
+        * WebKitTestRunner/efl/EventSenderProxyEfl.cpp:
+        (WTR):
+        (WTR::setEvasModifiers):
+        (WTR::EventSenderProxy::EventSenderProxy):
+        (WTR::EventSenderProxy::~EventSenderProxy):
+        (WTR::EventSenderProxy::sendTouchEvent):
+        (WTR::EventSenderProxy::addTouchPoint):
+        (WTR::EventSenderProxy::updateTouchPoint):
+        (WTR::EventSenderProxy::setTouchModifier):
+        (WTR::EventSenderProxy::touchStart):
+        (WTR::EventSenderProxy::touchMove):
+        (WTR::EventSenderProxy::touchEnd):
+        (WTR::EventSenderProxy::touchCancel):
+        (WTR::EventSenderProxy::clearTouchPoints):
+        (WTR::EventSenderProxy::releaseTouchPoint):
+        (WTR::EventSenderProxy::cancelTouchPoint):
+
 2012-09-24  Christophe Dumez  <christophe.dumez@intel.com>
 
         [WK2] TestRunner does not support overridePreference with value "0"
index 2e84c57..ce2c1a6 100644 (file)
@@ -34,6 +34,7 @@
 #include <gdk/gdk.h>
 #include <wtf/Vector.h>
 #elif PLATFORM(EFL)
+#include <WebKit2/EWebKit2.h>
 #include <wtf/Deque.h>
 #endif
 
@@ -50,6 +51,7 @@ struct WTREvent;
 class EventSenderProxy {
 public:
     explicit EventSenderProxy(TestController*);
+    ~EventSenderProxy();
 
     void mouseDown(unsigned button, WKEventModifiers);
     void mouseUp(unsigned button, WKEventModifiers);
@@ -97,6 +99,9 @@ private:
 #elif PLATFORM(EFL)
     void sendOrQueueEvent(const WTREvent&);
     void dispatchEvent(const WTREvent&);
+#if ENABLE(TOUCH_EVENTS)
+    void sendTouchEvent(Ewk_Touch_Event_Type);
+#endif
 #endif
 
     double m_time;
@@ -123,6 +128,9 @@ private:
 #elif PLATFORM(EFL)
     Deque<WTREvent> m_eventQueue;
     unsigned m_mouseButton;
+#if ENABLE(TOUCH_EVENTS)
+    Eina_List* m_touchPoints;
+#endif
 #endif
 };
 
index 0c73210..fc225e3 100644 (file)
@@ -45,6 +45,8 @@
 
 namespace WTR {
 
+static const char* modifierNames[] = { "Shift", "Control", "Alt", "Meta" };
+
 enum WTREventType {
     WTREventTypeNone = 0,
     WTREventTypeMouseDown,
@@ -133,7 +135,6 @@ static unsigned evasMouseButton(unsigned button)
 
 static void setEvasModifiers(Evas* evas, WKEventModifiers wkModifiers)
 {
-    static const char* modifierNames[] = { "Shift", "Control", "Alt", "Meta" };
     for (unsigned modifier = 0; modifier < (sizeof(modifierNames) / sizeof(char*)); ++modifier) {
         if (wkModifiers & (1 << modifier))
             evas_key_modifier_on(evas, modifierNames[modifier]);
@@ -293,9 +294,19 @@ EventSenderProxy::EventSenderProxy(TestController* testController)
     , m_clickTime(0)
     , m_clickButton(WTRMouseButtonNone)
     , m_mouseButton(WTRMouseButtonNone)
+#if ENABLE(TOUCH_EVENTS)
+    , m_touchPoints(0)
+#endif
 {
 }
 
+EventSenderProxy::~EventSenderProxy()
+{
+#if ENABLE(TOUCH_EVENTS)
+    clearTouchPoints();
+#endif
+}
+
 void EventSenderProxy::updateClickCountForButton(int button)
 {
     if (m_time - m_clickTime < 1 && m_position == m_clickPosition && button == m_clickButton) {
@@ -432,54 +443,117 @@ void EventSenderProxy::keyDown(WKStringRef keyRef, WKEventModifiers wkModifiers,
 }
 
 #if ENABLE(TOUCH_EVENTS)
+void EventSenderProxy::sendTouchEvent(Ewk_Touch_Event_Type eventType)
+{
+    ASSERT(m_touchPoints);
+
+    Evas_Object* ewkView = m_testController->mainWebView()->platformView();
+    ewk_view_feed_touch_event(ewkView, eventType, m_touchPoints, evas_key_modifier_get(evas_object_evas_get(ewkView)));
+
+    Eina_List* list;
+    Eina_List* listNext;
+    void* data;
+    EINA_LIST_FOREACH_SAFE(m_touchPoints, list, listNext, data) {
+         Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(data);
+         ASSERT(touchPoint);
+
+         if ((touchPoint->state == EVAS_TOUCH_POINT_UP) || (touchPoint->state == EVAS_TOUCH_POINT_CANCEL)) {
+             delete touchPoint;
+             m_touchPoints = eina_list_remove_list(m_touchPoints, list);
+         } else
+             touchPoint->state = EVAS_TOUCH_POINT_STILL;
+     }
+}
+
 void EventSenderProxy::addTouchPoint(int x, int y)
 {
-    notImplemented();
+    int id = 0;
+    if (m_touchPoints) {
+        Eina_List* last = eina_list_last(m_touchPoints);
+        Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_data_get(last));
+        ASSERT(touchPoint);
+
+        id = touchPoint->id + 1;
+    }
+
+    Ewk_Touch_Point* touchPoint = new Ewk_Touch_Point;
+    touchPoint->id = id;
+    touchPoint->x = x;
+    touchPoint->y = y;
+    touchPoint->state = EVAS_TOUCH_POINT_DOWN;
+
+    m_touchPoints = eina_list_append(m_touchPoints, touchPoint);
 }
 
 void EventSenderProxy::updateTouchPoint(int index, int x, int y)
 {
-    notImplemented();
+    ASSERT(index >= 0 && index < eina_list_count(m_touchPoints));
+
+    Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_nth(m_touchPoints, index));
+    ASSERT(touchPoint);
+
+    touchPoint->x = x;
+    touchPoint->y = y;
+    touchPoint->state = EVAS_TOUCH_POINT_MOVE;
 }
 
 void EventSenderProxy::setTouchModifier(WKEventModifiers modifier, bool enable)
 {
-    notImplemented();
+    for (unsigned index = 0; index < (sizeof(modifierNames) / sizeof(char*)); ++index) {
+        if (modifier & (1 << index)) {
+            if (enable)
+                evas_key_modifier_on(evas_object_evas_get(m_testController->mainWebView()->platformView()), modifierNames[index]);
+            else
+                evas_key_modifier_off(evas_object_evas_get(m_testController->mainWebView()->platformView()), modifierNames[index]);
+        }
+    }
 }
 
 void EventSenderProxy::touchStart()
 {
-    notImplemented();
+    sendTouchEvent(EWK_TOUCH_START);
 }
 
 void EventSenderProxy::touchMove()
 {
-    notImplemented();
+    sendTouchEvent(EWK_TOUCH_MOVE);
 }
 
 void EventSenderProxy::touchEnd()
 {
-    notImplemented();
+    sendTouchEvent(EWK_TOUCH_END);
 }
 
 void EventSenderProxy::touchCancel()
 {
-    notImplemented();
+    sendTouchEvent(EWK_TOUCH_CANCEL);
 }
 
 void EventSenderProxy::clearTouchPoints()
 {
-    notImplemented();
+    void* data = 0;
+    EINA_LIST_FREE(m_touchPoints, data)
+        delete static_cast<Ewk_Touch_Point*>(data);
 }
 
 void EventSenderProxy::releaseTouchPoint(int index)
 {
-    notImplemented();
+    ASSERT(index >= 0 && index < eina_list_count(m_touchPoints));
+
+    Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_nth(m_touchPoints, index));
+    ASSERT(touchPoint);
+
+    touchPoint->state = EVAS_TOUCH_POINT_UP;
 }
 
 void EventSenderProxy::cancelTouchPoint(int index)
 {
-    notImplemented();
+    ASSERT(index >= 0 && index < eina_list_count(m_touchPoints));
+
+    Ewk_Touch_Point* touchPoint = static_cast<Ewk_Touch_Point*>(eina_list_nth(m_touchPoints, index));
+    ASSERT(touchPoint);
+
+    touchPoint->state = EVAS_TOUCH_POINT_CANCEL;
 }
 
 void EventSenderProxy::setTouchPointRadius(int radiusX, int radiusY)