|
@@ -31,8 +31,6 @@ import com.owncloud.android.R;
|
|
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
|
import com.owncloud.android.db.OCUpload;
|
|
|
-import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation;
|
|
|
-import com.owncloud.android.operations.RefreshFolderOperation;
|
|
|
import com.owncloud.android.ui.dialog.ConflictsResolveDialog;
|
|
|
import com.owncloud.android.utils.FileStorageUtils;
|
|
|
import com.owncloud.android.utils.ScreenshotTest;
|
|
@@ -40,9 +38,6 @@ import com.owncloud.android.utils.ScreenshotTest;
|
|
|
import org.junit.Rule;
|
|
|
import org.junit.Test;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
-
|
|
|
import androidx.fragment.app.DialogFragment;
|
|
|
import androidx.test.espresso.intent.rule.IntentsTestRule;
|
|
|
|
|
@@ -95,59 +90,59 @@ public class ConflictsResolveActivityIT extends AbstractIT {
|
|
|
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
+// @Test
|
|
|
// @ScreenshotTest // todo run without real server
|
|
|
- public void screenshotImages() throws IOException {
|
|
|
- FileDataStorageManager storageManager = new FileDataStorageManager(account,
|
|
|
- targetContext.getContentResolver());
|
|
|
-
|
|
|
- OCFile newFile = new OCFile("/newFile.txt");
|
|
|
- newFile.setFileLength(56000);
|
|
|
- newFile.setModificationTimestamp(1522019340);
|
|
|
- newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
|
|
|
-
|
|
|
- File image = getFile("image.jpg");
|
|
|
-
|
|
|
- assertTrue(new UploadFileRemoteOperation(image.getAbsolutePath(),
|
|
|
- "/image.jpg",
|
|
|
- "image/jpg",
|
|
|
- "10000000").execute(client).isSuccess());
|
|
|
-
|
|
|
- assertTrue(new RefreshFolderOperation(storageManager.getFileByPath("/"),
|
|
|
- System.currentTimeMillis(),
|
|
|
- false,
|
|
|
- true,
|
|
|
- storageManager,
|
|
|
- account,
|
|
|
- targetContext
|
|
|
- ).execute(client).isSuccess());
|
|
|
-
|
|
|
- OCFile existingFile = storageManager.getFileByPath("/image.jpg");
|
|
|
-
|
|
|
- Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
|
|
- intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
|
|
- intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
|
|
-
|
|
|
- ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
|
|
-
|
|
|
- ConflictsResolveDialog.OnConflictDecisionMadeListener listener = decision -> {
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- ConflictsResolveDialog dialog = ConflictsResolveDialog.newInstance(existingFile,
|
|
|
- newFile,
|
|
|
- UserAccountManagerImpl
|
|
|
- .fromContext(targetContext)
|
|
|
- .getUser()
|
|
|
- );
|
|
|
- dialog.showDialog(sut);
|
|
|
- dialog.listener = listener;
|
|
|
-
|
|
|
- getInstrumentation().waitForIdleSync();
|
|
|
- shortSleep();
|
|
|
-
|
|
|
- Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
|
|
|
- }
|
|
|
+// public void screenshotImages() throws IOException {
|
|
|
+// FileDataStorageManager storageManager = new FileDataStorageManager(account,
|
|
|
+// targetContext.getContentResolver());
|
|
|
+//
|
|
|
+// OCFile newFile = new OCFile("/newFile.txt");
|
|
|
+// newFile.setFileLength(56000);
|
|
|
+// newFile.setModificationTimestamp(1522019340);
|
|
|
+// newFile.setStoragePath(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
|
|
|
+//
|
|
|
+// File image = getFile("image.jpg");
|
|
|
+//
|
|
|
+// assertTrue(new UploadFileRemoteOperation(image.getAbsolutePath(),
|
|
|
+// "/image.jpg",
|
|
|
+// "image/jpg",
|
|
|
+// "10000000").execute(client).isSuccess());
|
|
|
+//
|
|
|
+// assertTrue(new RefreshFolderOperation(storageManager.getFileByPath("/"),
|
|
|
+// System.currentTimeMillis(),
|
|
|
+// false,
|
|
|
+// true,
|
|
|
+// storageManager,
|
|
|
+// account,
|
|
|
+// targetContext
|
|
|
+// ).execute(client).isSuccess());
|
|
|
+//
|
|
|
+// OCFile existingFile = storageManager.getFileByPath("/image.jpg");
|
|
|
+//
|
|
|
+// Intent intent = new Intent(targetContext, ConflictsResolveActivity.class);
|
|
|
+// intent.putExtra(ConflictsResolveActivity.EXTRA_FILE, newFile);
|
|
|
+// intent.putExtra(ConflictsResolveActivity.EXTRA_EXISTING_FILE, existingFile);
|
|
|
+//
|
|
|
+// ConflictsResolveActivity sut = activityRule.launchActivity(intent);
|
|
|
+//
|
|
|
+// ConflictsResolveDialog.OnConflictDecisionMadeListener listener = decision -> {
|
|
|
+//
|
|
|
+// };
|
|
|
+//
|
|
|
+// ConflictsResolveDialog dialog = ConflictsResolveDialog.newInstance(existingFile,
|
|
|
+// newFile,
|
|
|
+// UserAccountManagerImpl
|
|
|
+// .fromContext(targetContext)
|
|
|
+// .getUser()
|
|
|
+// );
|
|
|
+// dialog.showDialog(sut);
|
|
|
+// dialog.listener = listener;
|
|
|
+//
|
|
|
+// getInstrumentation().waitForIdleSync();
|
|
|
+// shortSleep();
|
|
|
+//
|
|
|
+// Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
|
|
|
+// }
|
|
|
|
|
|
@Test
|
|
|
public void cancel() {
|