use of com.intellij.testFramework.ExpectedHighlightingData in project intellij-community by JetBrains.
the class LightDaemonAnalyzerTestCase method doTestFile.
protected HighlightTestInfo doTestFile(@NonNls @NotNull String filePath) {
return new HighlightTestInfo(getTestRootDisposable(), filePath) {
@Override
public HighlightTestInfo doTest() {
String path = assertOneElement(filePaths);
configureByFile(path);
ExpectedHighlightingData data = new JavaExpectedHighlightingData(myEditor.getDocument(), checkWarnings, checkWeakWarnings, checkInfos, myFile);
if (checkSymbolNames)
data.checkSymbolNames();
checkHighlighting(data, composeLocalPath(path));
return this;
}
};
}
use of com.intellij.testFramework.ExpectedHighlightingData in project intellij-community by JetBrains.
the class LightDaemonAnalyzerTestCase method doTestConfiguredFile.
protected void doTestConfiguredFile(boolean checkWarnings, boolean checkWeakWarnings, boolean checkInfos, @Nullable String filePath) {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
ExpectedHighlightingData data = getExpectedHighlightingData(checkWarnings, checkWeakWarnings, checkInfos);
checkHighlighting(data, composeLocalPath(filePath));
}
use of com.intellij.testFramework.ExpectedHighlightingData in project intellij-community by JetBrains.
the class DumpCleanHighlightingTestdataAction method actionPerformed.
@Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getProject();
final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
if (psiFile != null) {
final VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile != null) {
final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
if (document != null) {
final ExpectedHighlightingData data = new ExpectedHighlightingData(document, true, true);
data.init();
}
return;
}
}
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setTitle("Choose Directory");
descriptor.setDescription("Directory containing highlighting test data");
final VirtualFile dirToProcess = FileChooser.chooseFile(descriptor, project, null);
if (dirToProcess != null) {
LOG.assertTrue(project != null);
final FileChooserDescriptor targetDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
targetDescriptor.setTitle("Choose Directory");
targetDescriptor.setDescription("Directory where highlighting-markup-free copies would be placed");
final VirtualFile destinationFolder = FileChooser.chooseFile(targetDescriptor, project, null);
if (dirToProcess.equals(destinationFolder)) {
Messages.showErrorDialog(project, "Source and destination roots should differ", "Reject to Proceed");
return;
}
if (destinationFolder != null) {
final File destination = VfsUtilCore.virtualToIoFile(destinationFolder);
final VirtualFile[] files = dirToProcess.getChildren();
for (VirtualFile virtualFile : files) {
final Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
if (document != null) {
final ExpectedHighlightingData data = new ExpectedHighlightingData(document, true, true);
data.init();
final File file = new File(destination, virtualFile.getName());
try {
FileUtil.writeToFile(file, document.getText());
} catch (IOException ex) {
LOG.error(ex);
}
}
}
}
}
}
use of com.intellij.testFramework.ExpectedHighlightingData in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testSpellChecker.
@JSTestOptions(JSTestOption.WithFlexSdk)
public void testSpellChecker() throws Exception {
enableInspectionTool(new SpellCheckingInspection());
configureByFile(getBasePath() + "/" + getTestName(false) + ".mxml");
ExpectedHighlightingData expectedHighlightingData = new ExpectedHighlightingData(myEditor.getDocument(), true, true, false, myFile);
Collection<HighlightInfo> infoCollection = checkHighlighting(expectedHighlightingData);
assertEquals(1, countNonInformationHighlights(infoCollection));
findAndInvokeActionWithExpectedCheck("Typo: Rename to...", "mxml", infoCollection);
}
use of com.intellij.testFramework.ExpectedHighlightingData in project intellij-plugins by JetBrains.
the class ActionScriptHighlightingInTextFieldTest method doTestForEditorTextField.
private void doTestForEditorTextField(JSExpressionCodeFragment fragment) throws Exception {
myFile = fragment;
Document document = PsiDocumentManager.getInstance(myProject).getDocument(fragment);
final JSEditorTextField editorTextField = new JSEditorTextField(myProject, document);
// initialize editor
editorTextField.addNotify();
myEditor = editorTextField.getEditor();
try {
checkHighlighting(new ExpectedHighlightingData(editorTextField.getDocument(), true, true, true, myFile));
} finally {
editorTextField.removeNotify();
UIUtil.dispatchAllInvocationEvents();
}
}
Aggregations