Hide cursor to make UI test more stable

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-07-31 08:32:58 +02:00
parent 9f4d90f48b
commit 78128ff5dc
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 20 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -27,6 +27,9 @@ import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.content.Intent; import android.content.Intent;
import android.os.Looper; import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.nextcloud.client.account.RegisteredUser; import com.nextcloud.client.account.RegisteredUser;
import com.nextcloud.client.account.Server; import com.nextcloud.client.account.Server;
@ -161,6 +164,23 @@ public class DialogFragmentIT extends AbstractIT {
getInstrumentation().waitForIdleSync(); getInstrumentation().waitForIdleSync();
shortSleep(); shortSleep();
ViewGroup viewGroup = dialog.requireDialog().getWindow().findViewById(android.R.id.content);
hideCursors(viewGroup);
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()); screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
} }
private void hideCursors(ViewGroup viewGroup) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View child = viewGroup.getChildAt(i);
if (child instanceof ViewGroup) {
hideCursors((ViewGroup) child);
}
if (child instanceof TextView) {
((TextView) child).setCursorVisible(false);
}
}
}
} }