mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Fix FileDisplayActivity screenshot tests
Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
154755af9b
commit
2e593a034b
2 changed files with 17 additions and 9 deletions
|
@ -53,12 +53,14 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
|
|||
@ScreenshotTest
|
||||
fun open() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
sut.listOfFilesFragment!!.setFabEnabled(false)
|
||||
|
||||
shortSleep()
|
||||
sut.runOnUiThread {
|
||||
sut.listOfFilesFragment!!.setFabEnabled(false)
|
||||
sut.resetScrolling()
|
||||
sut.listOfFilesFragment!!.setEmptyListLoadingMessage()
|
||||
sut.listOfFilesFragment!!.isLoading = false
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
|
@ -103,13 +105,16 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
|
|||
fun drawer() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)).perform(DrawerActions.open())
|
||||
sut.listOfFilesFragment!!.setFabEnabled(false)
|
||||
sut.listOfFilesFragment!!.setEmptyListLoadingMessage()
|
||||
sut.listOfFilesFragment!!.isLoading = false
|
||||
|
||||
shortSleep()
|
||||
sut.runOnUiThread {
|
||||
sut.hideInfoBox()
|
||||
sut.resetScrolling()
|
||||
sut.listOfFilesFragment!!.setFabEnabled(false)
|
||||
sut.listOfFilesFragment!!.setEmptyListLoadingMessage()
|
||||
sut.listOfFilesFragment!!.isLoading = false
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
waitForIdleSync()
|
||||
screenshot(sut)
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ import java.util.List;
|
|||
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;
|
||||
|
@ -1267,7 +1268,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
OCFileListFragment ocFileListFragment = getListOfFilesFragment();
|
||||
if (ocFileListFragment != null) {
|
||||
ocFileListFragment.setLoading(mSyncInProgress);
|
||||
if (!mSyncInProgress) {
|
||||
if (!mSyncInProgress && !ocFileListFragment.isLoading()) {
|
||||
// update scrolling when load finishes
|
||||
if (ocFileListFragment.isEmpty()) {
|
||||
lockScrolling();
|
||||
|
@ -1526,7 +1527,8 @@ public class FileDisplayActivity extends FileActivity
|
|||
/**
|
||||
* Prevents content scrolling and toolbar collapse
|
||||
*/
|
||||
private void lockScrolling() {
|
||||
@VisibleForTesting
|
||||
public void lockScrolling() {
|
||||
final CoordinatorLayout.LayoutParams coordinatorParams = (CoordinatorLayout.LayoutParams) binding.rootLayout.getLayoutParams();
|
||||
coordinatorParams.setBehavior(null);
|
||||
binding.rootLayout.setLayoutParams(coordinatorParams);
|
||||
|
@ -1540,7 +1542,8 @@ public class FileDisplayActivity extends FileActivity
|
|||
/**
|
||||
* Resets content scrolling and toolbar collapse
|
||||
*/
|
||||
private void resetScrolling() {
|
||||
@VisibleForTesting
|
||||
public void resetScrolling() {
|
||||
final CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) binding.rootLayout.getLayoutParams();
|
||||
params.setBehavior(new AppBarLayout.ScrollingViewBehavior());
|
||||
binding.rootLayout.setLayoutParams(params);
|
||||
|
|
Loading…
Reference in a new issue