use of com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl in project kotlin by JetBrains.
the class AbstractKotlinFoldingTest method assertFoldingRegionsForFile.
// Rewritten version of CodeInsightTestFixtureImpl.testFoldingRegions(verificationFileName, true).
// Configure test with custom file name to force creating different editors for normal and inverted tests.
private void assertFoldingRegionsForFile(String verificationFileName, boolean doCheckCollapseStatus) {
String START_FOLD = "<fold\\stext=\'[^\']*\'(\\sexpand=\'[^\']*\')*>";
String END_FOLD = "</fold>";
String expectedContent;
File file = new File(verificationFileName);
try {
expectedContent = FileUtil.loadFile(file);
} catch (IOException e) {
throw new RuntimeException(e);
}
Assert.assertNotNull(expectedContent);
expectedContent = StringUtil.replace(expectedContent, "\r", "");
String cleanContent = expectedContent.replaceAll(START_FOLD, "").replaceAll(END_FOLD, "");
myFixture.configureByText(file.getName(), cleanContent);
String actual = ((CodeInsightTestFixtureImpl) myFixture).getFoldingDescription(doCheckCollapseStatus);
Assert.assertEquals(expectedContent, actual);
}
use of com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl in project intellij-plugins by JetBrains.
the class DartExtractLocalVariableRefactoringTest method createRefactoring.
@NotNull
private ServerExtractLocalVariableRefactoring createRefactoring(String filePath) {
((CodeInsightTestFixtureImpl) myFixture).canChangeDocumentDuringHighlighting(true);
final PsiFile psiFile = myFixture.configureByFile(filePath);
ApplicationManager.getApplication().runWriteAction(() -> {
try {
VfsUtil.saveText(psiFile.getVirtualFile(), StringUtil.convertLineSeparators(psiFile.getText(), "\r\n"));
} catch (IOException e) {
throw new RuntimeException(e);
}
});
// make sure server is warmed up
myFixture.doHighlighting();
// find the Element to rename
final SelectionModel selectionModel = getEditor().getSelectionModel();
int offset = selectionModel.getSelectionStart();
final int length = selectionModel.getSelectionEnd() - offset;
return new ServerExtractLocalVariableRefactoring(getProject(), psiFile.getVirtualFile(), offset, length);
}
use of com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl in project intellij-plugins by JetBrains.
the class DartInlineLocalRefactoringTest method createInlineLocalRefactoring.
@NotNull
private ServerInlineLocalRefactoring createInlineLocalRefactoring(String filePath) {
((CodeInsightTestFixtureImpl) myFixture).canChangeDocumentDuringHighlighting(true);
final PsiFile psiFile = myFixture.configureByFile(filePath);
// make sure server is warmed up
myFixture.doHighlighting();
// find the Element to rename
final int offset = getEditor().getCaretModel().getOffset();
return new ServerInlineLocalRefactoring(getProject(), psiFile.getVirtualFile(), offset, 0);
}
use of com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoReferenceImporterTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
myFixture.enableInspections(GoUnresolvedReferenceInspection.class);
((CodeInsightTestFixtureImpl) myFixture).canChangeDocumentDuringHighlighting(true);
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
defaultJavaOnTheFly = codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY;
defaultJavaMemberOnTheFly = codeInsightSettings.ADD_MEMBER_IMPORTS_ON_THE_FLY;
defaultGoOnTheFly = GoCodeInsightSettings.getInstance().isAddUnambiguousImportsOnTheFly();
codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = true;
codeInsightSettings.ADD_MEMBER_IMPORTS_ON_THE_FLY = true;
}
use of com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl in project intellij-plugins by JetBrains.
the class DartInlineMethodRefactoringTest method createRefactoring.
@NotNull
private ServerInlineMethodRefactoring createRefactoring(String filePath) {
((CodeInsightTestFixtureImpl) myFixture).canChangeDocumentDuringHighlighting(true);
final PsiFile psiFile = myFixture.configureByFile(filePath);
// make sure server is warmed up
myFixture.doHighlighting();
// find the Element to rename
final int offset = getEditor().getCaretModel().getOffset();
return new ServerInlineMethodRefactoring(getProject(), psiFile.getVirtualFile(), offset, 0);
}
Aggregations