### Question:
WXGesture extends GestureDetector.SimpleOnGestureListener implements OnTouchListener { @Override public boolean onTouch(View v, MotionEvent event) { try { boolean result = mGestureDetector.onTouchEvent(event); switch (event.getActionMasked()) { case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_DOWN: if(hasSameOrientationWithParent() && !isParentScrollable()){ ViewParent p; if ((p = component.getRealView().getParent()) != null) { p.requestDisallowInterceptTouchEvent(true); } } result |= handleMotionEvent(LowLevelGesture.ACTION_DOWN, event); break; case MotionEvent.ACTION_MOVE: result |= handleMotionEvent(LowLevelGesture.ACTION_MOVE, event); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: finishDisallowInterceptTouchEvent(v); result |= handleMotionEvent(LowLevelGesture.ACTION_UP, event); result |= handlePanMotionEvent(event); break; case MotionEvent.ACTION_CANCEL: finishDisallowInterceptTouchEvent(v); result |= handleMotionEvent(LowLevelGesture.ACTION_CANCEL, event); result |= handlePanMotionEvent(event); break; } return result; } catch (Exception e) { WXLogUtils.e("Gesture RunTime Error ", e); return false; } } WXGesture(WXComponent wxComponent, Context context); void setPreventMoveEvent(boolean preventMoveEvent); @Override boolean onTouch(View v, MotionEvent event); @Override void onLongPress(MotionEvent e); @Override boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY); @Override boolean onDown(MotionEvent e); static final String START; static final String MOVE; static final String END; static final String UNKNOWN; static final String LEFT; static final String RIGHT; static final String UP; static final String DOWN; }### Answer:
@Test public void testOnTouch() throws Exception { MotionEvent event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_DOWN,0,0,0); mGesture.onTouch(component.getHostView(),event); event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_MOVE,0,0,0); mGesture.onTouch(component.getHostView(),event); event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_UP,0,0,0); mGesture.onTouch(component.getHostView(),event); event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_POINTER_UP,0,0,0); mGesture.onTouch(component.getHostView(),event); event = MotionEvent.obtain(System.currentTimeMillis(), System.currentTimeMillis(),MotionEvent.ACTION_CANCEL,0,0,0); mGesture.onTouch(component.getHostView(),event); }