Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSergey Prigogin2016-07-12 23:39:35 -0400
committerSergey Prigogin2016-07-12 23:42:39 -0400
commit73fd0ef44b36fd04a8268b9600d4f21f91a43381 (patch)
treed9b82abd76678f85f9118c37a47509355e7eec0e /tests
parent30ce23c898392ba97114d8ba7cf5eddd7a0d6373 (diff)
downloadeclipse.platform.team-73fd0ef44b36fd04a8268b9600d4f21f91a43381.tar.gz
eclipse.platform.team-73fd0ef44b36fd04a8268b9600d4f21f91a43381.tar.xz
eclipse.platform.team-73fd0ef44b36fd04a8268b9600d4f21f91a43381.zip
Bug 213780 - Compare With direction should be configurableY20160714-1000I20160719-0800I20160716-1900
Fixed tests sensitive to the layout preference. Change-Id: Ib30bb4c7ac8b42a81d8e1e55a0f0a897de587b05
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ContentMergeViewerTest.java22
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java22
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CompareEditorTests.java26
4 files changed, 67 insertions, 14 deletions
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ContentMergeViewerTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ContentMergeViewerTest.java
index fd87e5d34..99e90de7a 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ContentMergeViewerTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/ContentMergeViewerTest.java
@@ -10,14 +10,19 @@
*******************************************************************************/
package org.eclipse.compare.tests;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
+import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
+import org.eclipse.compare.internal.ComparePreferencePage;
+import org.eclipse.compare.internal.CompareUIPlugin;
+import org.eclipse.compare.internal.ICompareUIConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
public class ContentMergeViewerTest extends TestCase {
private MyContentMergeViewer myContentMergeViewer;
@@ -37,7 +42,7 @@ public class ContentMergeViewerTest extends TestCase {
private class MyContentMergeViewer extends ContentMergeViewer {
protected MyContentMergeViewer() {
- super(0, null, null);
+ super(0, null, new CompareConfiguration());
}
public boolean leftDirty = false;
@@ -86,6 +91,9 @@ public class ContentMergeViewerTest extends TestCase {
}
protected void setUp() throws Exception {
+ super.setUp();
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setDefault(ComparePreferencePage.LAYOUT, ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT);
result = new boolean[] { false, false };
myContentMergeViewer = new MyContentMergeViewer();
myContentMergeViewer.addPropertyChangeListener(new IPropertyChangeListener() {
@@ -96,6 +104,12 @@ public class ContentMergeViewerTest extends TestCase {
});
}
+ protected void tearDown() throws Exception {
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setToDefault(ComparePreferencePage.LAYOUT);
+ super.tearDown();
+ }
+
// set left to true
public void testFFTX() {
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
index f7c068f3a..98b125d58 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
@@ -16,8 +16,6 @@ import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.ICompareFilter;
import org.eclipse.compare.IEditableContent;
@@ -25,6 +23,9 @@ import org.eclipse.compare.IStreamContentAccessor;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
import org.eclipse.compare.internal.ChangeCompareFilterPropertyAction;
+import org.eclipse.compare.internal.ComparePreferencePage;
+import org.eclipse.compare.internal.CompareUIPlugin;
+import org.eclipse.compare.internal.ICompareUIConstants;
import org.eclipse.compare.internal.IMergeViewerTestAdapter;
import org.eclipse.compare.internal.MergeViewerContentProvider;
import org.eclipse.compare.internal.Utilities;
@@ -33,6 +34,7 @@ import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
@@ -46,6 +48,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import junit.framework.TestCase;
+
public class TextMergeViewerTest extends TestCase {
/**
@@ -250,7 +254,19 @@ public class TextMergeViewerTest extends TestCase {
}
return document;
}
-
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setDefault(ComparePreferencePage.LAYOUT, ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT);
+ }
+
+ protected void tearDown() throws Exception {
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setToDefault(ComparePreferencePage.LAYOUT);
+ super.tearDown();
+ }
+
public void testCopyRightToLeft() throws Exception {
DiffNode parentNode = new DiffNode(new ParentTestElement(), new ParentTestElement());
String copiedText = "hi there";
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java
index 7591d873a..3daa4c94b 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java
@@ -16,14 +16,14 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Test;
-
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareViewerSwitchingPane;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
import org.eclipse.compare.internal.CompareEditor;
+import org.eclipse.compare.internal.ComparePreferencePage;
import org.eclipse.compare.internal.CompareUIPlugin;
+import org.eclipse.compare.internal.ICompareUIConstants;
import org.eclipse.compare.internal.MergeSourceViewer;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
@@ -36,6 +36,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Image;
@@ -48,6 +49,8 @@ import org.eclipse.team.tests.core.TeamTest;
import org.eclipse.team.ui.synchronize.SaveableCompareEditorInput;
import org.eclipse.ui.PlatformUI;
+import junit.framework.Test;
+
public class SaveableCompareEditorInputTest extends TeamTest {
public static Test suite() {
@@ -67,6 +70,8 @@ public class SaveableCompareEditorInputTest extends TeamTest {
protected void setUp() throws Exception {
super.setUp();
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setDefault(ComparePreferencePage.LAYOUT, ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT);
project = createProject("Project_", new String[] {
"File1.txt", "File2.txt" });
@@ -84,6 +89,8 @@ public class SaveableCompareEditorInputTest extends TeamTest {
protected void tearDown() throws Exception {
// remove log listener
RuntimeLog.removeLogListener(logListener);
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setToDefault(ComparePreferencePage.LAYOUT);
super.tearDown();
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CompareEditorTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CompareEditorTests.java
index dd0c8b15e..f8118bade 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CompareEditorTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CompareEditorTests.java
@@ -12,19 +12,25 @@ package org.eclipse.team.tests.ccvs.core.subscriber;
import java.io.ByteArrayInputStream;
-import junit.framework.Test;
-
-import org.eclipse.compare.*;
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.compare.ISharedDocumentAdapter;
+import org.eclipse.compare.SharedDocumentAdapter;
+import org.eclipse.compare.internal.ComparePreferencePage;
+import org.eclipse.compare.internal.CompareUIPlugin;
+import org.eclipse.compare.internal.ICompareUIConstants;
import org.eclipse.compare.internal.Utilities;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.history.FileRevisionTypedElement;
@@ -34,10 +40,16 @@ import org.eclipse.team.internal.ui.synchronize.EditableSharedDocumentAdapter;
import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;
import org.eclipse.team.internal.ui.synchronize.actions.OpenInCompareAction;
import org.eclipse.team.tests.ccvs.ui.ModelParticipantSyncInfoSource;
-import org.eclipse.ui.*;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import junit.framework.Test;
+
/**
* Test the behavior of compare editors opened on diffs.
*/
@@ -141,6 +153,8 @@ public class CompareEditorTests extends CVSSyncSubscriberTest {
protected void setUp() throws Exception {
super.setUp();
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setDefault(ComparePreferencePage.LAYOUT, ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT);
// Need to set both the Compare and Team test flags to true
Utilities.RUNNING_TESTS = true;
Utils.RUNNING_TESTS = true;
@@ -154,6 +168,8 @@ public class CompareEditorTests extends CVSSyncSubscriberTest {
protected void tearDown() throws Exception {
closeAllEditors();
+ IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
+ store.setToDefault(ComparePreferencePage.LAYOUT);
super.tearDown();
}

Back to the top