mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-08 11:00:02 +00:00
Merge pull request #11428 from Two-Ai/remove-returnActivity-test
Remove outdated returnActivity test code
This commit is contained in:
commit
fad3120b00
@ -2,7 +2,6 @@ package org.schabi.newpipe.error;
|
||||
|
||||
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@ -13,7 +12,6 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@ -22,7 +20,6 @@ import androidx.core.content.IntentCompat;
|
||||
import com.grack.nanojson.JsonWriter;
|
||||
|
||||
import org.schabi.newpipe.BuildConfig;
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.databinding.ActivityErrorBinding;
|
||||
import org.schabi.newpipe.util.Localization;
|
||||
@ -187,25 +184,6 @@ public class ErrorActivity extends AppCompatActivity {
|
||||
.collect(Collectors.joining(separator + "\n", separator + "\n", separator));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the checked activity.
|
||||
*
|
||||
* @param returnActivity the activity to return to
|
||||
* @return the casted return activity or null
|
||||
*/
|
||||
@Nullable
|
||||
static Class<? extends Activity> getReturnActivity(final Class<?> returnActivity) {
|
||||
Class<? extends Activity> checkedReturnActivity = null;
|
||||
if (returnActivity != null) {
|
||||
if (Activity.class.isAssignableFrom(returnActivity)) {
|
||||
checkedReturnActivity = returnActivity.asSubclass(Activity.class);
|
||||
} else {
|
||||
checkedReturnActivity = MainActivity.class;
|
||||
}
|
||||
}
|
||||
return checkedReturnActivity;
|
||||
}
|
||||
|
||||
private void buildInfo(final ErrorInfo info) {
|
||||
String text = "";
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
package org.schabi.newpipe.error;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.MainActivity;
|
||||
import org.schabi.newpipe.RouterActivity;
|
||||
import org.schabi.newpipe.fragments.detail.VideoDetailFragment;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ErrorActivity}.
|
||||
*/
|
||||
public class ErrorActivityTest {
|
||||
@Test
|
||||
public void getReturnActivity() {
|
||||
Class<? extends Activity> returnActivity;
|
||||
returnActivity = ErrorActivity.getReturnActivity(MainActivity.class);
|
||||
assertEquals(MainActivity.class, returnActivity);
|
||||
|
||||
returnActivity = ErrorActivity.getReturnActivity(RouterActivity.class);
|
||||
assertEquals(RouterActivity.class, returnActivity);
|
||||
|
||||
returnActivity = ErrorActivity.getReturnActivity(null);
|
||||
assertNull(returnActivity);
|
||||
|
||||
returnActivity = ErrorActivity.getReturnActivity(Integer.class);
|
||||
assertEquals(MainActivity.class, returnActivity);
|
||||
|
||||
returnActivity = ErrorActivity.getReturnActivity(VideoDetailFragment.class);
|
||||
assertEquals(MainActivity.class, returnActivity);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user