mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
CodeInsightTestFixture: add findAllGutters() & publish openFileInEditor
This commit is contained in:
+4
@@ -290,6 +290,8 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
|
||||
@NotNull
|
||||
HighlightTestInfo testFile(@NonNls @NotNull String... filePath);
|
||||
|
||||
void openFileInEditor(@NotNull VirtualFile file);
|
||||
|
||||
void testInspection(@NotNull String testDir, @NotNull InspectionToolWrapper toolWrapper);
|
||||
|
||||
/**
|
||||
@@ -462,6 +464,8 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
|
||||
@NotNull
|
||||
Collection<GutterMark> findAllGutters(@NotNull @TestDataFile String filePath);
|
||||
|
||||
Collection<GutterMark> findAllGutters();
|
||||
|
||||
void type(final char c);
|
||||
|
||||
void type(@NotNull String s);
|
||||
|
||||
+8
-4
@@ -441,6 +441,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFileInEditor(@NotNull final VirtualFile file) {
|
||||
myFile = file;
|
||||
myEditor = createEditor(file);
|
||||
@@ -930,9 +931,15 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<GutterMark> findAllGutters(@NotNull final String filePath) {
|
||||
configureByFilesInner(filePath);
|
||||
return findAllGutters();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<GutterMark> findAllGutters() {
|
||||
final Project project = getProject();
|
||||
final SortedMap<Integer, List<GutterMark>> result = new TreeMap<Integer, List<GutterMark>>();
|
||||
configureByFilesInner(filePath);
|
||||
|
||||
List<HighlightInfo> infos = doHighlighting();
|
||||
for (HighlightInfo info : infos) {
|
||||
@@ -1461,9 +1468,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
private Editor createEditor(@NotNull VirtualFile file) {
|
||||
final Project project = getProject();
|
||||
final FileEditorManager instance = FileEditorManager.getInstance(project);
|
||||
if (file.getFileType().isBinary()) {
|
||||
return null;
|
||||
}
|
||||
Editor editor = instance.openTextEditor(new OpenFileDescriptor(project, file), false);
|
||||
if (editor != null) {
|
||||
editor.getCaretModel().moveToOffset(0);
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.intellij.lang.xpath.xslt;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.PsiFileEx;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
|
||||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
||||
import org.intellij.lang.xpath.TestBase;
|
||||
import org.intellij.lang.xpath.xslt.impl.XsltChecker;
|
||||
|
||||
@@ -95,7 +93,7 @@ public class XsltBasicTest extends TestBase {
|
||||
final String fileName = getTestFileName();
|
||||
String path = fileName.replaceAll("_.*$", "") + ".xsl";
|
||||
final VirtualFile file = myFixture.copyFileToProject(path);
|
||||
((CodeInsightTestFixtureImpl)myFixture).openFileInEditor(file);
|
||||
myFixture.openFileInEditor(file);
|
||||
if (fileName.endsWith("_Loaded")) {
|
||||
((XmlFile)myFixture.getFile()).getDocument();
|
||||
assertTrue(((PsiFileEx)myFixture.getFile()).isContentsLoaded());
|
||||
|
||||
Reference in New Issue
Block a user