diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-14 18:06:57 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-17 18:52:19 +0200 |
commit | 7998b2a262aa809f9879d51e6edc55ddadcf2699 (patch) | |
tree | 160108a455270eb858f1b43c7ada93daa5a3676b /OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain | |
parent | 6f47c78981efd8e135e3e3cf2b5818bfd17970d4 (diff) | |
download | open-keychain-7998b2a262aa809f9879d51e6edc55ddadcf2699.tar.gz open-keychain-7998b2a262aa809f9879d51e6edc55ddadcf2699.tar.bz2 open-keychain-7998b2a262aa809f9879d51e6edc55ddadcf2699.zip |
instrument: add helper method for snackbar checking
Diffstat (limited to 'OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain')
-rw-r--r-- | OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomMatchers.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomMatchers.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomMatchers.java new file mode 100644 index 000000000..29e875b95 --- /dev/null +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/actions/CustomMatchers.java @@ -0,0 +1,27 @@ +package org.sufficientlysecure.keychain.actions; + + +import android.support.annotation.ColorRes; +import android.support.test.espresso.matcher.BoundedMatcher; +import android.view.View; + +import com.nispok.snackbar.Snackbar; +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +public abstract class CustomMatchers { + + public static Matcher<View> withSnackbarLineColor(@ColorRes final int colorRes) { + return new BoundedMatcher<View, Snackbar>(Snackbar.class) { + public void describeTo(Description description) { + description.appendText("with color resource id: " + colorRes); + } + + @Override + public boolean matchesSafely(Snackbar snackbar) { + return snackbar.getResources().getColor(colorRes) == snackbar.getLineColor(); + } + }; + } + +} |