use of com.intellij.codeInsight.daemon.impl.HighlightInfo in project intellij-community by JetBrains.
the class XmlHighlightingTest method testduplicateAttribute2.
public void testduplicateAttribute2() throws Exception {
configureByFiles(null, BASE_PATH + getTestName(false) + ".xml", BASE_PATH + getTestName(false) + ".xsd");
final String url = "http://www.foo.org/schema";
final String url2 = "http://www.bar.org/foo";
ExternalResourceManagerExImpl.registerResourceTemporarily(url, getTestName(false) + ".xsd", getTestRootDisposable());
ExternalResourceManagerExImpl.registerResourceTemporarily(url2, getTestName(false) + ".xsd", getTestRootDisposable());
final Collection<HighlightInfo> infoCollection = doDoTest(true, false, true);
final TextRange startTagNameRange = XmlTagUtil.getStartTagNameElement(((XmlFile) myFile).getDocument().getRootTag()).getTextRange();
HighlightInfo infoAtTagName = null;
for (HighlightInfo info : infoCollection) {
if (info.startOffset == startTagNameRange.getStartOffset() && info.endOffset == startTagNameRange.getEndOffset()) {
if (info.getDescription().equals("Attribute \"foo\" bound to namespace \"http://www.w3.org/2000/xmlns/\" was already specified for element \"root\".")) {
infoAtTagName = info;
break;
}
}
}
assertNotNull(infoAtTagName);
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfo in project intellij-community by JetBrains.
the class XmlHighlightingTest method testChangeRootElement.
public void testChangeRootElement() throws Exception {
enableInspectionTool(new XmlWrongRootElementInspection());
final String testName = getTestName(false);
configureByFile(BASE_PATH + testName + ".xml");
Collection<HighlightInfo> infos = doDoTest(true, false);
findAndInvokeIntentionAction(infos, "Change root tag name to xxx", myEditor, myFile);
checkResultByFile(BASE_PATH + testName + "_after.xml");
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfo in project intellij-community by JetBrains.
the class XmlHighlightingTest method testResolvedDtdElementReferences.
public void testResolvedDtdElementReferences() throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".dtd");
doDoTest(true, false);
final String text = myEditor.getDocument().getText();
WriteCommandAction.runWriteCommandAction(null, () -> myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength()));
AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_COMMENT_BLOCK);
action.actionPerformed(AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContext()));
assertNotSame(text, myEditor.getDocument().getText());
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
Collection<HighlightInfo> infos = doHighlighting();
assertEquals(0, infos.size());
action.actionPerformed(AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContext()));
assertEquals(text, myEditor.getDocument().getText().trim());
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
infos = doHighlighting();
assertEquals(0, infos.size());
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfo in project intellij-community by JetBrains.
the class HighlightingTestBase method doCustomHighlighting.
protected void doCustomHighlighting(boolean checkWeakWarnings, Boolean includeExternalToolPass) {
final PsiFile file = myTestFixture.getFile();
final Document doc = myTestFixture.getEditor().getDocument();
ExpectedHighlightingData data = new ExpectedHighlightingData(doc, true, checkWeakWarnings, false, file);
data.init();
PsiDocumentManager.getInstance(myTestFixture.getProject()).commitAllDocuments();
Collection<HighlightInfo> highlights1 = doHighlighting(includeExternalToolPass);
data.checkResult(highlights1, doc.getText());
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfo in project intellij-community by JetBrains.
the class SpellcheckerPerformanceTest method testManyWhitespaces.
public void testManyWhitespaces() {
final int count = 100000;
String text = StringUtil.repeat("//\n \t \t \n \n", count);
long start = System.currentTimeMillis();
VirtualFile file = myFixture.addFileToProject("foo.java", text).getVirtualFile();
System.out.println("creation took " + (System.currentTimeMillis() - start) + " ms");
start = System.currentTimeMillis();
myFixture.configureFromExistingVirtualFile(file);
System.out.println("configure took " + (System.currentTimeMillis() - start) + " ms");
start = System.currentTimeMillis();
List<HighlightInfo> infos = runLocalInspections();
assertEmpty(infos);
System.out.println("warm-up took " + (System.currentTimeMillis() - start) + " ms");
PlatformTestUtil.startPerformanceTest("many whitespaces highlighting", 4000, () -> {
DaemonCodeAnalyzer.getInstance(getProject()).restart();
assertEmpty(runLocalInspections());
}).cpuBound().assertTiming();
}
Aggregations