optimize imports
This commit is contained in:
parent
882e18f472
commit
fb70b2ac7d
6 changed files with 18 additions and 6 deletions
|
@ -27,6 +27,8 @@ import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
|||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.adapter.NewsListRecyclerAdapter;
|
||||
import de.luhmer.owncloudnewsreader.adapter.ViewHolder;
|
||||
import helper.OrientationChangeAction;
|
||||
import helper.RecyclerViewAssertions;
|
||||
|
||||
import static androidx.test.InstrumentationRegistry.getInstrumentation;
|
||||
import static androidx.test.InstrumentationRegistry.registerInstance;
|
||||
|
|
|
@ -20,12 +20,14 @@ import java.time.Instant;
|
|||
import java.time.ZoneOffset;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.espresso.assertion.ViewAssertions;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
|
||||
import helper.CustomMatchers;
|
||||
|
||||
import static android.preference.PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES;
|
||||
import static androidx.test.InstrumentationRegistry.getInstrumentation;
|
||||
|
@ -39,9 +41,11 @@ import static androidx.test.espresso.matcher.PreferenceMatchers.withSummary;
|
|||
import static androidx.test.espresso.matcher.PreferenceMatchers.withTitle;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static de.luhmer.owncloudnewsreader.SettingsActivity.CB_OLED_MODE;
|
||||
import static de.luhmer.owncloudnewsreader.SettingsActivity.SP_APP_THEME;
|
||||
import static helper.CustomMatchers.withBackgroundColor;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
|
@ -88,12 +92,14 @@ public class NightModeTest {
|
|||
defaultValueSp.edit().putBoolean(KEY_HAS_SET_DEFAULT_VALUES, false).commit();
|
||||
|
||||
|
||||
/*
|
||||
// Set Fixed time
|
||||
Instant.now(
|
||||
Clock.fixed(
|
||||
Instant.parse( "2019-04-05T18:00:00Z"), ZoneOffset.UTC
|
||||
)
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,7 +108,7 @@ public class NightModeTest {
|
|||
launchActivity();
|
||||
|
||||
assertFalse(isDarkTheme());
|
||||
//onView(withId(R.id.sliding_layout)).check(ViewAssertions.matches(CustomMatchers.withBackgroundColor(android.R.color.white, getActivity())));
|
||||
onView(withId(R.id.sliding_layout)).check(matches(withBackgroundColor(android.R.color.white, getActivity())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package de.luhmer.owncloudnewsreader.tests;
|
||||
package helper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
@ -38,7 +38,7 @@ public class CustomMatchers {
|
|||
Drawable drawable = view.getBackground();
|
||||
Drawable otherDrawable = ContextCompat.getDrawable(view.getContext(), resourceColorId);
|
||||
|
||||
if (drawable instanceof ColorDrawable && otherDrawable instanceof ColorDrawable) {
|
||||
if (drawable instanceof ColorDrawable) {
|
||||
int colorId = ((ColorDrawable) drawable).getColor();
|
||||
|
||||
if(colorId == resourceColorId) {
|
||||
|
@ -47,7 +47,9 @@ public class CustomMatchers {
|
|||
error = "FAILED Got: " + colorId;
|
||||
}
|
||||
} else {
|
||||
error = "Not color drawables!!";
|
||||
Log.e(TAG, drawable.toString());
|
||||
Log.e(TAG, otherDrawable.toString());
|
||||
error = "Not ColorDrawable's!!";
|
||||
}
|
||||
|
||||
return false;
|
|
@ -23,7 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package de.luhmer.owncloudnewsreader.tests;
|
||||
package helper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ActivityInfo;
|
|
@ -1,4 +1,4 @@
|
|||
package de.luhmer.owncloudnewsreader.tests;
|
||||
package helper;
|
||||
|
||||
import androidx.test.espresso.NoMatchingViewException;
|
||||
import androidx.test.espresso.ViewAssertion;
|
|
@ -31,8 +31,10 @@ import tools.fastlane.screengrab.locale.LocaleTestRule;
|
|||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ScreenshotTest {
|
||||
|
||||
@ClassRule
|
||||
public static final LocaleTestRule localTestRule = new LocaleTestRule();
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<NewsReaderListActivity> mActivityRule = new ActivityTestRule<>(NewsReaderListActivity.class);
|
||||
|
||||
|
|
Loading…
Reference in a new issue