show expected FILE on the left of the diff view to be able to apply changes from actual right in the file

This commit is contained in:
anna
2011-10-10 17:37:28 +02:00
parent 8cdd88eb8c
commit c8eafbe32f
9 changed files with 56 additions and 20 deletions
@@ -34,6 +34,7 @@ import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.List;
@@ -75,17 +76,22 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
protected void doTest(@NonNls String filePath, boolean checkWarnings, boolean checkInfos) throws Exception {
configureByFile(filePath);
doTestConfiguredFile(checkWarnings, checkInfos);
doTestConfiguredFile(checkWarnings, checkInfos, filePath);
}
protected void doTestConfiguredFile(boolean checkWarnings, boolean checkInfos) {
protected void doTestConfiguredFile(boolean checkWarnings, boolean checkInfos, String filePath) {
getJavaFacade().setAssertOnFileLoadingFilter(VirtualFileFilter.NONE);
ExpectedHighlightingData data = new ExpectedHighlightingData(getEditor().getDocument(),checkWarnings, checkInfos);
checkHighlighting(data);
checkHighlighting(data, composeLocalPath(filePath));
}
private void checkHighlighting(ExpectedHighlightingData data) {
@Nullable
private String composeLocalPath(String filePath) {
return filePath != null ? getTestDataPath() + "/" + filePath : null;
}
private void checkHighlighting(ExpectedHighlightingData data, String filePath) {
data.init();
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
@@ -97,7 +103,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
getJavaFacade().setAssertOnFileLoadingFilter(VirtualFileFilter.NONE);
data.checkResult(infos, getEditor().getDocument().getText());
data.checkResult(infos, getEditor().getDocument().getText(), filePath);
}
protected HighlightTestInfo testFile(@NonNls @NotNull String filePath) {
@@ -109,7 +115,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
ExpectedHighlightingData data = new ExpectedHighlightingData(myEditor.getDocument(), checkWarnings, checkWeakWarnings, checkInfos, myFile);
if (checkSymbolNames) data.checkSymbolNames();
checkHighlighting(data);
checkHighlighting(data, composeLocalPath(path));
return this;
}
};
@@ -30,6 +30,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.rt.execution.junit.FileComparisonFailure;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.ui.UIUtil;
@@ -84,6 +85,9 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
quickFixTestCase.afterActionCompleted(testName, contents);
}
}
catch (FileComparisonFailure e){
throw e;
}
catch (Throwable e) {
e.printStackTrace();
fail(testName);
@@ -21,6 +21,7 @@
<orderEntry type="library" name="Groovy" level="project" />
<orderEntry type="module" module-name="testFramework" exported="" />
<orderEntry type="module" module-name="relaxng" exported="" scope="TEST" />
<orderEntry type="module" module-name="junit_rt" />
</component>
<component name="copyright">
<Base>