Skip to content

Commit

Permalink
test for #6905
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
  • Loading branch information
tobiasKaminsky committed Nov 24, 2020
1 parent 879157e commit 8d59f51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@
import org.junit.Rule;
import org.junit.Test;

import androidx.test.espresso.Espresso;
import androidx.test.espresso.contrib.DrawerActions;
import androidx.test.espresso.contrib.NavigationViewActions;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static junit.framework.TestCase.assertEquals;
Expand Down Expand Up @@ -175,4 +173,15 @@ public void openAccountSwitcher() {

Espresso.onView(withId(R.id.switch_account_button)).perform(click());
}

@Test
public void audioPlayerRemoveFile() {
FileDisplayActivity sut = activityRule.launchActivity(null);

sut.tryStopPlaying(new OCFile("/test.mp3"));

longSleep();

Assert.assertTrue(true); // if we reach this, everything is ok
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
import javax.inject.Inject;

import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SearchView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
Expand Down Expand Up @@ -1782,9 +1783,10 @@ private void onRestoreFileVersionOperationFinish(RemoteOperationResult result) {
}
}

private void tryStopPlaying(OCFile file) {
@VisibleForTesting
public void tryStopPlaying(OCFile file) {
// placeholder for stop-on-delete future code
if(mPlayerConnection != null) {
if (mPlayerConnection != null) {
mPlayerConnection.stop(file);
}
}
Expand Down

0 comments on commit 8d59f51

Please sign in to comment.