Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-11-29 21:35:59 +0000
committerStefan Lay2011-11-30 12:23:15 +0000
commit8a524f1f0802b045f8ad84b01df710002ed5fb76 (patch)
tree5d29c54f89f918c3d6ec771014d442d147e45a80 /org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit
parent75a1cf972c4a501ef0a991c1346ca95e66c9eb5a (diff)
downloadegit-8a524f1f0802b045f8ad84b01df710002ed5fb76.tar.gz
egit-8a524f1f0802b045f8ad84b01df710002ed5fb76.tar.xz
egit-8a524f1f0802b045f8ad84b01df710002ed5fb76.zip
Support 'Show Annotations' on history items
Blame can now be run from the file table in the history view as well as the file section of the commit editor. The blame operation will open the file in a read-only editor and show annotations starting at the selected commit. Bug: 362052 Change-Id: I8c88d704581f50e5c406724100d7e8ee31f72701 Signed-off-by: Kevin Sawicki <kevin@github.com>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
index b3d77446fe..7e0e25e149 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/commit/CommitEditorTest.java
@@ -11,6 +11,7 @@
package org.eclipse.egit.ui.test.commit;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -18,14 +19,20 @@ import java.io.File;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.egit.core.Activator;
+import org.eclipse.egit.ui.JobFamilies;
+import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.commit.CommitEditor;
import org.eclipse.egit.ui.internal.commit.RepositoryCommit;
+import org.eclipse.egit.ui.test.ContextMenuHelper;
+import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
@@ -90,4 +97,32 @@ public class CommitEditorTest extends LocalRepositoryTestCase {
botEditor.activatePage(name);
botEditor.close();
}
+
+ @Test
+ public void showAnnotations() throws Exception {
+ final AtomicReference<IEditorPart> editorRef = new AtomicReference<IEditorPart>();
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+
+ public void run() {
+ RepositoryCommit repoCommit = new RepositoryCommit(repository,
+ commit);
+ editorRef.set(CommitEditor.openQuiet(repoCommit));
+ }
+ });
+ assertNotNull(editorRef.get());
+ SWTBotEditor commitEditor = bot.activeEditor();
+ SWTBotTable table = commitEditor.bot().table(0);
+ assertTrue(table.rowCount() > 0);
+ table.select(0);
+ ContextMenuHelper.clickContextMenu(table,
+ UIText.CommitFileDiffViewer_ShowAnnotationsMenuLabel);
+ TestUtil.joinJobs(JobFamilies.BLAME);
+ assertFalse(commitEditor.getReference().equals(
+ bot.activeEditor().getReference()));
+
+ final String content = getTestFileContent();
+ // Change working directory content to validate blame opens HEAD
+ setTestFileContent("updated content" + System.nanoTime());
+ assertEquals(content, bot.activeEditor().toTextEditor().getText());
+ }
}

Back to the top