Merge pull request #4205 from ByteHamster/skip-icon

Feed settings skip icon
This commit is contained in:
H. Lehmann 2020-05-30 14:58:03 +02:00 committed by GitHub
commit 175abdc63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,79 @@
package de.test.antennapod.ui;
import android.content.Intent;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.feed.Feed;
import de.test.antennapod.EspressoTestUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static de.test.antennapod.EspressoTestUtils.clickPreference;
import static de.test.antennapod.EspressoTestUtils.waitForView;
import static org.hamcrest.Matchers.allOf;
@RunWith(AndroidJUnit4.class)
public class FeedSettingsTest {
private UITestUtils uiTestUtils;
private Feed feed;
@Rule
public IntentsTestRule<MainActivity> activityRule = new IntentsTestRule<>(MainActivity.class, false, false);
@Before
public void setUp() throws Exception {
uiTestUtils = new UITestUtils(InstrumentationRegistry.getInstrumentation().getTargetContext());
uiTestUtils.setup();
EspressoTestUtils.clearPreferences();
EspressoTestUtils.clearDatabase();
uiTestUtils.addLocalFeedData(false);
feed = uiTestUtils.hostedFeeds.get(0);
Intent intent = new Intent(InstrumentationRegistry.getInstrumentation().getTargetContext(), MainActivity.class);
intent.putExtra(MainActivity.EXTRA_FEED_ID, feed.getId());
activityRule.launchActivity(intent);
}
@After
public void tearDown() throws Exception {
uiTestUtils.tearDown();
}
@Test
public void testClickFeedSettings() {
onView(isRoot()).perform(waitForView(allOf(isDescendantOfA(withId(R.id.appBar)),
withText(feed.getTitle()), isDisplayed()), 1000));
onView(withId(R.id.butShowSettings)).perform(click());
clickPreference(R.string.keep_updated);
clickPreference(R.string.authentication_label);
onView(withText(R.string.cancel_label)).perform(click());
clickPreference(R.string.playback_speed);
onView(withText(R.string.cancel_label)).perform(click());
clickPreference(R.string.pref_feed_skip);
onView(withText(R.string.cancel_label)).perform(click());
clickPreference(R.string.auto_delete_label);
onView(withText(R.string.cancel_label)).perform(click());
clickPreference(R.string.feed_volume_reduction);
onView(withText(R.string.cancel_label)).perform(click());
}
}

View File

@ -23,6 +23,7 @@
<Preference
android:key="feedAutoSkip"
android:icon="?attr/ic_settings_skip"
android:summary="@string/pref_feed_skip_sum"
android:title="@string/pref_feed_skip" />

View File

@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path android:fillColor="#FF000000" android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
</vector>

View File

@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path android:fillColor="#FFFFFFFF" android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
</vector>

View File

@ -52,6 +52,7 @@
<attr name="currently_playing_background" format="color"/>
<attr name="ic_bookmark" format="reference"/>
<attr name="ic_settings_speed" format="reference" />
<attr name="ic_settings_skip" format="reference" />
<attr name="drawer_activated_color" format="color"/>
<attr name="batch_edit_fab_icon" format="reference"/>
<attr name="action_icon_color" format="color"/>

View File

@ -35,6 +35,7 @@
<item name="av_fast_forward">@drawable/ic_av_fast_forward_black_48dp</item>
<item name="av_skip">@drawable/ic_av_skip_black_48dp</item>
<item name="ic_settings_speed">@drawable/ic_playback_speed_black</item>
<item name="ic_settings_skip">@drawable/ic_av_skip_black_24dp</item>
<item name="ic_delete">@drawable/ic_delete_black</item>
<item name="content_new">@drawable/ic_add_black</item>
<item name="content_remove_from_queue">@drawable/ic_remove_black</item>
@ -109,6 +110,7 @@
<item name="av_play">@drawable/ic_av_play_white_48dp</item>
<item name="av_skip">@drawable/ic_av_skip_white_48dp</item>
<item name="ic_settings_speed">@drawable/ic_playback_speed_white</item>
<item name="ic_settings_skip">@drawable/ic_av_skip_white_24dp</item>
<item name="ic_delete">@drawable/ic_delete_white</item>
<item name="content_new">@drawable/ic_add_white</item>
<item name="content_remove_from_queue">@drawable/ic_remove_white</item>