Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
index 9a984b58d..65e0d934d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
@@ -36,6 +36,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.op.CommitOperation;
import org.eclipse.egit.core.op.TagOperation;
+import org.eclipse.egit.core.test.TestUtils;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
@@ -130,6 +131,39 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
}
@Test
+ public void testCheckoutWithConflictsAndReset() throws Exception {
+ String charset = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(PROJ1).getDefaultCharset();
+ String file1Content = getTestFileContent();
+ checkoutAndVerify(new String[] { LOCAL_BRANCHES, "stable" });
+ ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1)
+ .getFolder(FOLDER).getFile(FILE1).setContents(
+ new ByteArrayInputStream(
+ "New content".getBytes(charset)),
+ IResource.NONE, null);
+ String file2Content = "Also changed";
+ ResourcesPlugin.getWorkspace().getRoot().getProject(PROJ1)
+ .getFolder(FOLDER).getFile(FILE2).setContents(
+ new ByteArrayInputStream(
+ file2Content.getBytes(charset)),
+ IResource.NONE, null);
+ checkout(new String[] { LOCAL_BRANCHES, "master" });
+ SWTBotShell showConflicts = bot
+ .shell(UIText.BranchResultDialog_CheckoutConflictsTitle);
+ SWTBot shellBot = showConflicts.bot();
+ SWTBotTreeItem[] items = shellBot.tree().getAllItems();
+ assertEquals(1, items.length);
+ assertEquals(FILE1, items[0].getItems()[0].getItems()[0].getText());
+ shellBot.button(UIText.BranchResultDialog_buttonDiscardChanges).click();
+ TestUtils.waitForJobs(500, 5000, JobFamilies.DISCARD_CHANGES);
+ TestUtil.joinJobs(JobFamilies.CHECKOUT);
+ assertEquals(file1Content, getTestFileContent());
+ // FILE2 should _not_ have been reset since it didn't conflict with the
+ // checkout and wasn't shown in the conflict dialog
+ assertEquals(file2Content, getTestFileContent(FILE2));
+ }
+
+ @Test
public void testCheckoutWithNonDeleted() throws Exception {
// we need to check if this file system has problems to
// delete a file with an open FileInputStrem

Back to the top