use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class SyncedFoldersActivityIT method open.
@Test
@ScreenshotTest
public void open() {
Activity sut = activityRule.launchActivity(null);
screenshot(sut);
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class DialogFragmentIT method testRemoveFileDialog.
@Test
@ScreenshotTest
public void testRemoveFileDialog() {
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(new OCFile("/Test.md"));
showDialog(dialog);
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class DialogFragmentIT method testAccountChooserDialogWithStatusDisabled.
@Test
@ScreenshotTest
public void testAccountChooserDialogWithStatusDisabled() throws AccountUtils.AccountNotFoundException {
AccountManager accountManager = AccountManager.get(targetContext);
for (Account account : accountManager.getAccounts()) {
accountManager.removeAccountExplicitly(account);
}
Account newAccount = new Account("test@https://nextcloud.localhost", MainApp.getAccountType(targetContext));
accountManager.addAccountExplicitly(newAccount, "password", null);
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_OC_BASE_URL, SERVER_URL);
accountManager.setUserData(newAccount, AccountUtils.Constants.KEY_USER_ID, "test");
accountManager.setAuthToken(newAccount, AccountTypeUtils.getAuthTokenTypePass(newAccount.type), "password");
FileDisplayActivity fda = getFileDisplayActivity();
UserAccountManager userAccountManager = fda.getUserAccountManager();
User newUser = userAccountManager.getUser(newAccount.name).get();
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(newUser, targetContext.getContentResolver());
OCCapability capability = new OCCapability();
capability.setUserStatus(CapabilityBooleanType.FALSE);
fileDataStorageManager.saveCapabilities(capability);
ChooseAccountDialogFragment sut = ChooseAccountDialogFragment.newInstance(new RegisteredUser(newAccount, new OwnCloudAccount(newAccount, targetContext), new Server(URI.create(SERVER_URL), OwnCloudVersion.nextcloud_20)));
showDialog(fda, sut);
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class DialogFragmentIT method testBottomSheet.
@Test
@ScreenshotTest
public void testBottomSheet() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
OCFileListBottomSheetActions action = new OCFileListBottomSheetActions() {
@Override
public void createFolder() {
}
@Override
public void uploadFromApp() {
}
@Override
public void uploadFiles() {
}
@Override
public void newDocument() {
}
@Override
public void newSpreadsheet() {
}
@Override
public void newPresentation() {
}
@Override
public void directCameraUpload() {
}
@Override
public void scanDocUpload() {
}
@Override
public void showTemplate(Creator creator, String headline) {
}
@Override
public void createRichWorkspace() {
}
};
DeviceInfo info = new DeviceInfo();
OCFile ocFile = new OCFile("/test.md");
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
FileDisplayActivity fda = activityRule.launchActivity(intent);
// add direct editing info
DirectEditing directEditing = new DirectEditing();
directEditing.getCreators().put("1", new Creator("1", "text", "text file", ".md", "application/octet-stream", false));
directEditing.getCreators().put("2", new Creator("2", "md", "markdown file", ".md", "application/octet-stream", false));
directEditing.getEditors().put("text", new Editor("1", "Text", new ArrayList<>(Collections.singletonList(MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN)), new ArrayList<>(), false));
String json = new Gson().toJson(directEditing);
new ArbitraryDataProvider(targetContext.getContentResolver()).storeOrUpdateKeyValue(user.getAccountName(), ArbitraryDataProvider.DIRECT_EDITING, json);
// activate templates
OCCapability capability = fda.getCapabilities();
capability.setRichDocuments(CapabilityBooleanType.TRUE);
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE);
capability.setRichDocumentsTemplatesAvailable(CapabilityBooleanType.TRUE);
OCFileListBottomSheetDialog sut = new OCFileListBottomSheetDialog(fda, action, info, user, ocFile);
fda.runOnUiThread(sut::show);
waitForIdleSync();
screenshot(sut.getWindow().getDecorView());
}
use of com.owncloud.android.utils.ScreenshotTest in project android by nextcloud.
the class DialogFragmentIT method testEnforcedPasswordDialog.
@Test
@ScreenshotTest
public void testEnforcedPasswordDialog() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
SharePasswordDialogFragment sut = SharePasswordDialogFragment.newInstance(new OCFile("/"), true, false);
showDialog(sut);
}
Aggregations