public void testConvertSceneToSurfaceTouchEventNonCenter() { this.mCamera.setCenter(0, 0); final TouchEvent touchEvent = TouchEvent.obtain(-50, -50, TouchEvent.ACTION_DOWN, 0, null); final int surfaceWidth = 100; final int surfaceHeight = 100; this.mCamera.convertSceneToSurfaceTouchEvent(touchEvent, surfaceWidth, surfaceHeight); Assert.assertEquals(0, touchEvent.getX(), DELTA); Assert.assertEquals(0, touchEvent.getY(), DELTA); }
protected boolean fireTouchEvent( final float pX, final float pY, final int pAction, final int pPointerID, final MotionEvent pMotionEvent) { final TouchEvent touchEvent = TouchEvent.obtain(pX, pY, pAction, pPointerID, MotionEvent.obtain(pMotionEvent)); final TouchEventRunnablePoolItem touchEventRunnablePoolItem = this.mTouchEventRunnablePoolUpdateHandler.obtainPoolItem(); touchEventRunnablePoolItem.set(touchEvent); this.mTouchEventRunnablePoolUpdateHandler.postPoolItem(touchEventRunnablePoolItem); return true; }