-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add a User Failure event Listener * Adding tests for the new listener
- Loading branch information
Showing
4 changed files
with
127 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
example/src/androidTest/java/com/ncorti/slidetoact/example/testutil/SlideViewActions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.ncorti.slidetoact.example.testutil; | ||
|
||
import android.support.test.espresso.ViewAction; | ||
import android.support.test.espresso.action.CoordinatesProvider; | ||
import android.support.test.espresso.action.GeneralClickAction; | ||
import android.support.test.espresso.action.Press; | ||
import android.support.test.espresso.action.Tap; | ||
import android.view.View; | ||
|
||
public class SlideViewActions { | ||
/** | ||
* Perform a click in the center of the View. | ||
*/ | ||
public static ViewAction clickCenter() { | ||
return new GeneralClickAction( | ||
Tap.SINGLE, | ||
new CoordinatesProvider() { | ||
@Override | ||
public float[] calculateCoordinates(View view) { | ||
|
||
final int[] screenPos = new int[2]; | ||
view.getLocationOnScreen(screenPos); | ||
final float width = view.getWidth(); | ||
final float height = view.getHeight(); | ||
|
||
final float centerX = screenPos[0] + (width / 2); | ||
final float centerY = screenPos[1] + (height / 2); | ||
|
||
float[] coordinates = {centerX, centerY}; | ||
|
||
return coordinates; | ||
} | ||
}, | ||
Press.FINGER); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters