mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Close WhatsNewActivity if open
Signed-off-by: Unpublished <unpublished@gmx.net>
This commit is contained in:
parent
bd4bc646c6
commit
c635e2e49a
1 changed files with 13 additions and 0 deletions
|
@ -1,14 +1,20 @@
|
|||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.nextcloud.client.whatsnew.WhatsNewActivity;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import androidx.test.core.app.ActivityScenario;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.rule.GrantPermissionRule;
|
||||
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
|
||||
|
||||
import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
import static androidx.test.runner.lifecycle.Stage.RESUMED;
|
||||
|
||||
public class FileDisplayActivityTest extends AbstractIT {
|
||||
|
||||
|
@ -17,6 +23,13 @@ public class FileDisplayActivityTest extends AbstractIT {
|
|||
@Test
|
||||
public void testSetupToolbar() {
|
||||
try (ActivityScenario<FileDisplayActivity> scenario = ActivityScenario.launch(FileDisplayActivity.class)) {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
|
||||
Activity activity =
|
||||
ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(RESUMED).iterator().next();
|
||||
if (activity instanceof WhatsNewActivity) {
|
||||
activity.onBackPressed();
|
||||
}
|
||||
});
|
||||
scenario.recreate();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue