Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
301,000
void () { final XmlFile xmlFile = createXmlFile("<root aaa= bbb=\"a\"/>"); final XmlTag tag = xmlFile.getDocument().getRootTag(); final XmlAttributeValueManipulator manipulator = new XmlAttributeValueManipulator(); assertEquals(TextRange.from(0, 0), manipulator.getRangeInElement(tag.getAttribute("aaa").getValueElement())); assertEquals(TextRange.from(1, 1), manipulator.getRangeInElement(tag.getAttribute("bbb").getValueElement())); }
testXmlAttributeValueManipulatorRange
301,001
void () { final XmlFile xmlFile = createXmlFile("<root>xxx</root>"); final XmlTag tag = xmlFile.getDocument().getRootTag(); final XmlText text = tag.getValue().getTextElements()[0]; final XmlTextManipulator manipulator = new XmlTextManipulator(); assertEquals(TextRange.from(0, 3), manipulator.getRangeInElement(text)); manipulator.handleContentChange(text, TextRange.from(1, 1), "AA"); assertEquals("<root>xAAx</root>", tag.getText()); }
testXmlTextManipulator
301,002
void () { final XmlFile xmlFile = createXmlFile("<root bbb=\"${fn:endsWith(item.class,'com.vships.vignette.domain.NewsItem')}\"/>"); final XmlAttributeValue value = xmlFile.getDocument().getRootTag().getAttribute("bbb").getValueElement(); final XmlAttributeValueManipulator manipulator = new XmlAttributeValueManipulator(); manipulator.handleContentChange(value, new TextRange(27, 63), "xxxwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"); }
testAttrValueChange
301,003
void () { final XmlFile xmlFile = createXmlFile("<root bbb=\"a&gt;\"/>"); final XmlAttributeValue value = xmlFile.getDocument().getRootTag().getAttribute("bbb").getValueElement(); final XmlAttributeValueManipulator manipulator = new XmlAttributeValueManipulator(); manipulator.handleContentChange(value, new TextRange(1, 6), "xxxwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"); }
testAttrValueWithEntities
301,004
void () { final XmlFile xmlFile = createXmlFile("<root bbb=\"\"/>"); XmlTag tag = xmlFile.getDocument().getRootTag(); final XmlAttributeValue value = tag.getAttribute("bbb").getValueElement(); final XmlAttributeValueManipulator manipulator = new XmlAttributeValueManipulator(); manipulator.handleContentChange(value, TextRange.from(1, 0), "\"'"); assertEquals("<root bbb=\"&quot;'\"/>", tag.getText()); }
testAttrValueEscapeDouble
301,005
void () { final XmlFile xmlFile = createXmlFile("<root bbb=''/>"); XmlTag tag = xmlFile.getDocument().getRootTag(); final XmlAttributeValue value = tag.getAttribute("bbb").getValueElement(); final XmlAttributeValueManipulator manipulator = new XmlAttributeValueManipulator(); manipulator.handleContentChange(value, TextRange.from(1, 0), "\"'"); assertEquals("<root bbb='\"&apos;'/>", tag.getText()); }
testAttrValueEscapeSingle
301,006
void () { final XmlFile xmlFile = createXmlFile("<root bbb=\"&#34;\"/>"); XmlTag tag = xmlFile.getDocument().getRootTag(); final XmlAttributeValue value = tag.getAttribute("bbb").getValueElement(); final XmlAttributeValueManipulator manipulator = new XmlAttributeValueManipulator(); manipulator.handleContentChange(value, TextRange.from(1, 0), "\"'"); assertEquals("<root bbb=\"&#34;'&#34;\"/>", tag.getText()); }
testAttrValueEscapeDoubleWithEntity
301,007
void () { final XmlFile xmlFile = createXmlFile("<root bbb='&#39;'/>"); XmlTag tag = xmlFile.getDocument().getRootTag(); final XmlAttributeValue value = tag.getAttribute("bbb").getValueElement(); final XmlAttributeValueManipulator manipulator = new XmlAttributeValueManipulator(); manipulator.handleContentChange(value, TextRange.from(1, 0), "\"'"); assertEquals("<root bbb='\"&#39;&#39;'/>", tag.getText()); }
testAttrValueEscapeSingleWithEntity
301,008
String (String name) { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + BASE_PATH + name; }
fullName
301,009
void () { Runnable runnable = () -> ApplicationManager.getApplication().runReadAction(() -> { try { getTreeTextByFile(getTestName(false) + ".html"); } catch (Exception ex) { throw new RuntimeException(ex); } }); for(int i = 0; i < 300; ++i) { final Runnable runnable1 = runnable; runnable = () -> ApplicationManager.getApplication().runReadAction(() -> { @SuppressWarnings("UnusedDeclaration") int a = 1; final Runnable run = runnable1; // ensure stack allocated for frame run.run(); }); } runnable.run(); }
testParserStackOverflow2
301,010
void () { prepareFile( """ <span jwcid="@Border"> <form jwcid="@Form"> <table class="textblock"> <tr> <td> Result </""" , """ <span> <input value='ognl'/> Weak Positive <br/> </span> </fieldset> </td> </tr> </table> </form> </span>"""); insert("aaa"); }
testReparseOnTyping1
301,011
void () { prepareFile("<span><td></","></span>"); insert("aaa"); }
testReparseOnTypingTiny
301,012
void () { //prepareFile( // "<html>\n" + // "<body>\n" + // "<div>\n" + // " <div id=\"top\"", // ">\n" + // " <div id=\"nav\"><ul>\n" + // "\t\t\t<li><a href=\"../devnet/\">Developers</a></li>\n" + // " <li><a href=\"../company/index.html\">Company</a></li>\n" + // " </ul></div>\n" + // " </div>\n" + // " </div>\n" + // "</body>\n" + // "</html>"); //remove(1); //insert("\""); prepareFile( "<p>\n something\n", "</p>" ); insert("<div"); insert(" id"); insert("="); insert("\""); insert("\""); insert("/"); insert(">"); }
testReparseOnTyping
301,013
void () { prepareFile( "<p>\n something\n", "</p>" ); insert("<div"); insert(" id=\"aaa\""); insert("/"); insert(">"); }
testReparseOnTyping6
301,014
void () { prepareFile(""" <html> <body> <""", """ a></a> </body> </html>"""); insert("!--"); remove(3); }
testReparseOnTyping5
301,015
void () { prepareFile( "<importbean>" + "<droplet>" + "<param value=\"bean:/meredith/SiteProperties.usingLightWeightVersion\"", "<td bgcolor=\"`request.getParameter(\"promoBGC1\")`\"></td>\n" + "</droplet>"); insert("/>"); }
testReparseOnTyping4
301,016
void () { prepareFile( """ <span jwcid="@Border"> <form jwcid="@Form"> <table class="textblock"> <tr> <td> Result <""" , """ <span> <input value='ognl'/> Weak Positive <br/> </span> </fieldset> </td> </tr> </table> </form> </span>"""); insert("aaa"); }
testReparseOnTyping3
301,017
void () { prepareFile(""" <ul> <li> <li> </""", "ul>"); insert("o"); remove(1); }
testReparseOnTyping2
301,018
void () { prepareFile("",""); insert(""" <html> <body><table> \t<tr> \t\t<td> <ol> <li><b>Where should one turn with questions, concerning this Web-site?</b><br> For all questions, concerning this Web-site, please contact us by e-mail: <br><br> <li><b>I have additional questions, which are not listed above.</b><br> For all other questions, please contact us by e-mail: </li> </ol> \t\t</td> \t\t<td> \t\t<table> \t\t<form> \t\t<INPUT> \t\t</tr></form></table> \t\t</td> \t</tr> </table> </body> </html>"""); }
testPaste
301,019
void () { String s = """ <html> <body> <hr> <table> \t<tr> \t\t<td> \t\t<br> \t\t<table> \t\t\t<tr> \t\t\t\t<td><nobr>Ctrl + <b>W</nobr></b></td> \t\t\t</tr> \t\t</table><br> \t\t<br> \t\t<table> \t\t\t<tr> \t\t\t\t<td><b><nobr>Ctrl + Numpad/</b></nobr></td> \t\t\t</tr><tr> \t\t\t\t<td><b><nobr>Ctrl + Numpad+</b></nobr></td> \t\t\t</tr> \t\t</table><br> \t\t<br>\t\t \t\t<br> \t\t</td> \t</tr> </table> <hr> </body> </html>"""; int markerPos; String s1; String s2; String marker = "</b>"; String marker2 = "</nobr>"; markerPos = s.indexOf(marker); s1 = s.substring(0,markerPos); s2 = s.substring(markerPos); prepareFile(s1,s2); remove(marker.length()); markerPos = s.indexOf(marker2) + marker2.length(); s1 = s.substring(0,markerPos); s2 = s.substring(markerPos); prepareFile(s1,s2); remove(marker2.length()); moveEditPointRight(marker.length()); insert(marker2); markerPos = s.indexOf(marker,markerPos+marker2.length()) + marker.length(); setEditPoint(markerPos); remove(marker.length()); moveEditPointRight(marker2.length()); insert(marker); markerPos = s.indexOf(marker,markerPos+marker2.length()) + marker.length(); setEditPoint(markerPos); remove(marker.length()); moveEditPointRight(marker2.length()); insert(marker); String NewMarker = "A-A"; s = "<html><body><p id=1>AAAAA" + NewMarker + "<p id=3>BBBB</body></html>"; markerPos = s.indexOf(NewMarker) + NewMarker.length(); prepareFile(s.substring(0,markerPos),s.substring(markerPos)); insert("<p id=2>ZZZZ"); }
testEdit
301,020
String () { return BASE_PATH; }
getTestDataPath
301,021
void (@NotNull XmlAttribute attribute) { myOutput .append(" Attribute: ").append(attribute.getName()) .append("(") .append(attribute.getNamespace().isEmpty() ? "default" : attribute.getNamespace()) .append(")\n"); visitXmlElement(attribute); }
visitXmlAttribute
301,022
void (@NotNull XmlTag tag) { myOutput.append("Tag: ").append(tag.getName()) .append("(").append(tag.getNamespace().isEmpty() ? "default" : tag.getNamespace()) .append(")\n"); visitXmlElement(tag); }
visitXmlTag
301,023
String () { return myOutput.toString(); }
getOutputString
301,024
String () { return PathManagerEx.getCommunityHomePath() + "/xml/tests/testData"; }
getTestDataPath
301,025
boolean () { return ourTestsWithDocumentUpdate.contains(getTestName(false)); }
doCheckDocumentUpdate
301,026
void () { PlatformTestUtil.startPerformanceTest("reformat code fragment", 6300, () -> checkFormattingDoesNotProduceException("performance")).useLegacyScaling().assertTiming(); }
testReformatCodeFragment
301,027
void () { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { PlatformTestUtil.startPerformanceTest("xml formatter", 6800, createTestRunnable()).useLegacyScaling().assertTiming(); highlight(); long start = System.currentTimeMillis(); final UndoManager undoManager = UndoManager.getInstance(getProject()); final FileEditor selectedEditor = editorManager.getSelectedEditor(myFile.getVirtualFile()); assertTrue(undoManager.isUndoAvailable(selectedEditor)); undoManager.undo(selectedEditor); long end = System.currentTimeMillis(); PlatformTestUtil.assertTiming("Fix xml formatter undo performance problem", 3400, end - start); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); highlight(); start = System.currentTimeMillis(); undoManager.redo(selectedEditor); end = System.currentTimeMillis(); PlatformTestUtil.assertTiming("Fix xml formatter redo performance problem", 3400, end - start); } finally { UIUtil.dispatchAllInvocationEvents(); final VirtualFile[] selectedFiles = editorManager.getSelectedFiles(); if (selectedFiles.length > 0) editorManager.closeFile(selectedFiles[0]); } }
testPerformance3
301,028
void () { CodeInsightTestFixtureImpl.instantiateAndRun(myFile, myEditor, new int[]{Pass.UPDATE_ALL, Pass.LOCAL_INSPECTIONS}, false); }
highlight
301,029
void () { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { PlatformTestUtil.startPerformanceTest("xml formatter", 20000, createTestRunnable()).useLegacyScaling().assertTiming(); } finally { editorManager.closeFile(editorManager.getSelectedFiles()[0]); } }
testPerformance4
301,030
ThrowableRunnable () { return () -> { try { doTest(); } finally { UIUtil.dispatchAllInvocationEvents(); } }; }
createTestRunnable
301,031
void () { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { PlatformTestUtil.startPerformanceTest("xml formatter", 10000, createTestRunnable()).useLegacyScaling().assertTiming(); } finally { final VirtualFile[] selectedFiles = editorManager.getSelectedFiles(); for (VirtualFile selectedFile : selectedFiles) { editorManager.closeFile(selectedFile); } } }
testPerformance5
301,032
void () { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { PlatformTestUtil.startPerformanceTest("xml formatter", 20000, createTestRunnable()).useLegacyScaling().assertTiming(); } finally { final VirtualFile[] selectedFiles = editorManager.getSelectedFiles(); if (selectedFiles.length > 0) editorManager.closeFile(selectedFiles[0]); } }
testPerformance6
301,033
void () { PlatformTestUtil.startPerformanceTest("xml formatter", 3_000, createTestRunnable()).assertTiming(); }
testPerformance7
301,034
ThrowableRunnable (final @NotNull PsiFile file) { return () -> { final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(file); assertNotNull(document); CodeStyleManager.getInstance(getProject()).adjustLineIndent(file, file.getTextRange()); }; }
createAdjustLineIndentInRangeRunnable
301,035
String () { return BASE_PATH; }
getBasePath
301,036
String () { return "xml"; }
getFileExtension
301,037
String () { return "psi/formatter/html"; }
getBasePath
301,038
String () { return "html"; }
getFileExtension
301,039
void () { getHtmlSettings().HTML_KEEP_LINE_BREAKS = false; doTextTest(""" <root> <aaa/> <aaa></aaa> <aaa/> </root>""", """ <root> <aaa/> <aaa></aaa> <aaa/> </root>"""); }
test13
301,040
void () { doTextTest("<div> text <div/> text <div> text </div> </div>", """ <div> text <div/> text <div> text</div> </div>"""); }
testSpaces
301,041
void () { //getSettings().HTML_PLACE_ON_NEW_LINE += ",div"; doTextTest("<div>ReSharper</div>", "<div>ReSharper</div>"); doTextTest("<div>Re\nSharper</div>", "<div>Re\n Sharper\n</div>"); doTextTest("<div>Re\nSharper </div>", "<div>Re\n Sharper\n</div>"); }
testClosingDivOnNextLine
301,042
void () { doTextTest("<html><body><table></table></body></html>", """ <html> <body> <table></table> </body> </html>"""); doTextTest("<html><body><table></table><tag></tag></body></html>", """ <html> <body> <table></table> <tag></tag> </body> </html>"""); doTextTest("<html><body><table></table> text</body></html>", """ <html> <body> <table></table> text </body> </html>"""); doTextTest("<html><body><table></table>text</body></html>", """ <html> <body> <table></table> text </body> </html>"""); }
testLineFeedAfterWrappedTag
301,043
void () { getSettings().setDefaultRightMargin(5); getHtmlSettings().HTML_TEXT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED; doTextTest(""" <html> text textV&aelig;lg JE </html>""", """ <html> text textV&aelig;lg JE </html>"""); getSettings().setDefaultRightMargin(2); doTextTest("<html><a>&aelig;</a></html>", """ <html> <a>&aelig;</a> </html>"""); }
testSCR3654
301,044
void () { @NonNls String fileText = """ <html> <head><title>Simple jsp page</title></head> <body> <p>Place your co</p> <p>ntent here</p> </body> </html>"""; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("test.html", fileText); final XmlTag bodyTag = file.getDocument().getRootTag().getSubTags()[1]; CodeStyleManager.getInstance(getProject()).reformatRange( bodyTag, bodyTag.getTextRange().getStartOffset(), bodyTag.getTextRange().getEndOffset()); }
testHtmlReformatDoesntProduceAssertion
301,045
void () { @NonNls String fileText = """ <html> <head><title>Simple jsp page</title></head> <body> <p>Place your co</p> <p>ntent here</p> </body> </html>"""; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("test.xhtml", fileText); final XmlTag bodyTag = file.getDocument().getRootTag().getSubTags()[1]; CodeStyleManager.getInstance(getProject()).reformatRange( bodyTag, bodyTag.getTextRange().getStartOffset(), bodyTag.getTextRange().getEndOffset()); }
testXhtmlReformatDoesntProduceAssertion
301,046
void () { doTextTest( """ <html> <body> <label> <textarea> This my text which should appear as is </textarea> </label> </body> </html>""", """ <html> <body> <label> <textarea> This my text which should appear as is </textarea> </label> </body> </html>""" ); }
testWeb456
301,047
void () { final HtmlCodeStyleSettings settings = getHtmlSettings(); int noIndentMinLines = settings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_LINES; settings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_LINES = 3; try { doTextTest( """ <table> <tr> <td>Cell 1.</td> <td>Cell 2.</td> </tr> <tr> <td>Cell 3.</td> </tr> </table>""", """ <table> <tr> <td>Cell 1.</td> <td>Cell 2.</td> </tr> <tr> <td>Cell 3.</td> </tr> </table>""" ); } finally { settings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_LINES = noIndentMinLines; } }
testWeb2405
301,048
void () { doTextTest( """ <div\s id="some" class="some" >""", """ <div id="some" class="some" >""" ); }
testWeb12840
301,049
void () { doTextTest( """ <img id="image-id" className="thumbnail" src="/some/path/to/the/images/image-name.png" alt='image' />""", """ <img id="image-id" className="thumbnail" src="/some/path/to/the/images/image-name.png" alt='image' />""" ); }
testWeb16223
301,050
void () { doTextTest( """ <div id="top"></div><!-- /#top --> <div id="nav"> <div id="logo"></div><!-- /#logo --> </div>""", """ <div id="top"></div><!-- /#top --> <div id="nav"> <div id="logo"></div><!-- /#logo --> </div>""" ); }
testWeb12937
301,051
boolean () { return "Performance".equals(getTestName(false)); }
doCheckDocumentUpdate
301,052
void () { doTextTest( """ <p>foobar</p> <div>foobar</div> <p>foobar</p> <div>foobar</div> <div>foobar</div> <p>foobar</p> <p>foobar</p> <div> <p>foobar</p> <div>foobar</div> <p>foobar</p> <div>foobar</div> <div>foobar</div> <p>foobar</p> <p>foobar</p> </div>""", """ <p>foobar</p> <div>foobar</div> <p>foobar</p> <div>foobar</div> <div>foobar</div> <p>foobar</p> <p>foobar</p> <div> <p>foobar</p> <div>foobar</div> <p>foobar</p> <div>foobar</div> <div>foobar</div> <p>foobar</p> <p>foobar</p> </div>""" ); }
test10809
301,053
void () { doTextTest(""" <!doctype html> <html> <body> <section> <pre><code class="language-javascript">function test(i) { if (i===1) { console.log('output'); } }</code></pre> </section> </body> </html>""", """ <!doctype html> <html> <body> <section> <pre><code class="language-javascript">function test(i) { if (i===1) { console.log('output'); } }</code></pre> </section> </body> </html>"""); }
testWeb18909
301,054
void () { doTextTest( """ <div class="s"> <span class="loading"></span> <span> Loading... </span> </div>""", """ <div class="s"> <span class="loading"></span> <span> Loading... </span> </div>""" ); }
testWeb18213
301,055
void () { final HtmlCodeStyleSettings settings = getHtmlSettings(); settings.HTML_SPACE_INSIDE_EMPTY_TAG = true; doTextTest(""" <div class="emptyWithAttributes"/> <div/> <div class="notEmpty"></div>""", """ <div class="emptyWithAttributes" /> <div /> <div class="notEmpty"></div>"""); }
testSpaceInEmptyTag
301,056
void () { final HtmlCodeStyleSettings settings = getHtmlSettings(); settings.HTML_NEWLINE_BEFORE_FIRST_ATTRIBUTE = CodeStyleSettings.HtmlTagNewLineStyle.WhenMultiline; settings.HTML_NEWLINE_AFTER_LAST_ATTRIBUTE = CodeStyleSettings.HtmlTagNewLineStyle.WhenMultiline; String source = """ <div class="singleline" foo="1" bar="2"/> <div class="singleline"></div> <div class="multiline" foo="1" bar="2"></div> <div class="selfClosingMultiline" foo="1" bar="2" /> <!--void tags--> <input type="button" value="Ok"> <br> """; doTextTest( source, """ <div class="singleline" foo="1" bar="2"/> <div class="singleline"></div> <div class="multiline" foo="1" bar="2" ></div> <div class="selfClosingMultiline" foo="1" bar="2" /> <!--void tags--> <input type="button" value="Ok"> <br> """); settings.HTML_SPACE_INSIDE_EMPTY_TAG = true; doTextTest( source, """ <div class="singleline" foo="1" bar="2" /> <div class="singleline"></div> <div class="multiline" foo="1" bar="2" ></div> <div class="selfClosingMultiline" foo="1" bar="2" /> <!--void tags--> <input type="button" value="Ok"> <br> """); }
testMultilineTags_NewlinesBeforeAndAfterAttributes
301,057
HtmlCodeStyleSettings () { return CodeStyle.getSettings(getProject()).getCustomSettings(HtmlCodeStyleSettings.class); }
getHtmlSettings
301,058
void () { XmlCodeStyleSettings xmlSettings = getSettings().getCustomSettings(XmlCodeStyleSettings.class); xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = true; doTextTest("<test/>", "<test />"); xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = false; doTextTest("<test />", "<test/>"); }
testSCR1574
301,059
void () { XmlCodeStyleSettings xmlSettings = getSettings().getCustomSettings(XmlCodeStyleSettings.class); xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = true; doTextTest("<a attr=\"value\"/>", "<a attr=\"value\" />"); }
testSCR1798
301,060
void () { doTextTest("<a b=\"/>","<a b=\"/>"); }
testIDEA55230
301,061
long () { Runtime runtime = Runtime.getRuntime(); long maxMemory = runtime.maxMemory(); return runtime.freeMemory() + (maxMemory - runtime.totalMemory()); }
currentFreeMemory
301,062
String () { return BASE_PATH; }
getBasePath
301,063
String () { return "xml"; }
getFileExtension
301,064
void () { doTextTest( """ <para> My <link>link</link> within text. </para>""", """ <para> My <link>link</link> within text. </para>""" ); }
testIdea52549
301,065
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/xmlRename/"; }
getTestDataPath
301,066
void () { final PsiElement elementAt = myFile.findElementAt(myEditor.getCaretModel().getOffset()); final XmlTag parentOfType = PsiTreeUtil.getParentOfType(elementAt, XmlTag.class); final XmlElementDescriptor descriptor = parentOfType.getDescriptor(); assertTrue("Rename of another func dcl failed",descriptor instanceof XmlElementDescriptorImpl && parentOfType.getLocalName().equals(descriptor.getName())); }
checkDescriptorRenamed
301,067
PsiReference[] () { PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil .ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); final PsiReference[] references = ReferencesSearch.search(element, GlobalSearchScope.allScope(myProject), true).toArray(PsiReference.EMPTY_ARRAY); return references; }
findReferencesToReferencedElementAtCaret
301,068
void (String newName) { PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil .ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); assertTrue(newName + " is not a valid name", RenameUtil.isValidName(myProject, element, newName)); new RenameProcessor(myProject, element, newName, false, false).run(); }
performAction
301,069
String (boolean isOriginal) { return "/xml/tests/testData/editor/" + getTestName(true) + (isOriginal ? ".xml" : "_after.xml") ; }
getTestFilePath
301,070
void () { configureByFile(getTestFilePath(true)); for (int i = 0; i < 3; i++) { EditorTestUtil.performTypingAction(getEditor(), '\n'); } PlatformTestUtil.startPerformanceTest("Xml editor enter", 5000, () -> { for (int i = 0; i < 3; i ++) { EditorTestUtil.performTypingAction(getEditor(), '\n'); } }).attempts(1).assertTiming(); checkResultByFile(getTestFilePath(false)); }
testEnterPerformance
301,071
void () { configureFromFileText("a.xml", """ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"> <g> <path clip-path="url(#SVGID_2_)" fill="#ffffff" stroke="<selection>#000000</selection>" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M19.333,8.333V12c0,1.519-7.333,4-7.333,4s-7.333-2.481-7.333-4V8.333"/> </g> </svg>"""); CodeStyle.doWithTemporarySettings( getProject(), CodeStyle.getSettings(getProject()), clone -> { clone.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true; CodeStyleSettingsManager.getInstance(getProject()).notifyCodeStyleSettingsChanged(); EditorTestUtil.performTypingAction(getEditor(), 'x'); } ); checkResultByText(""" <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"> <g> <path clip-path="url(#SVGID_2_)" fill="#ffffff" stroke="x" stroke-width="2" stroke-linecap="round"\s stroke-linejoin="round" stroke-miterlimit="10" d="M19.333,8.333V12c0,1.519-7.333,4-7.333,4s-7.333-2.481-7.333-4V8.333"/> </g> </svg>"""); }
testHardWrap
301,072
void () { configureFromFileText("a.xml", "<!-- Some very long and informative xml comment to trigger hard wrapping indeed. Too short? Dave, let me ask you something. Are hard wraps working? What do we live for? What ice-cream do you like? Who am I?????????????????????????????????????????????????????????????????????????????????????????????????<caret>-->"); CodeStyle.doWithTemporarySettings( getProject(), CodeStyle.getSettings(getProject()), clone -> { clone.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true; CodeStyleSettingsManager.getInstance(getProject()).notifyCodeStyleSettingsChanged(); EditorTestUtil.performTypingAction(getEditor(), '?'); } ); checkResultByText("<!-- Some very long and informative xml comment to trigger hard wrapping indeed. Too short? Dave, let me ask you \n" + "something. Are hard wraps working? What do we live for? What ice-cream do you like? Who am I??????????????????????????????????????????????????????????????????????????????????????????????????-->"); }
testHardWrapInComment
301,073
String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/'); }
getTestDataPath
301,074
void () { configureFromFileText(getTestName(true) + ".xml", """ <body> a<caret>b cd </body>"""); executeAction(IdeActions.ACTION_EDITOR_JOIN_LINES); checkResultByText(""" <body> ab cd </body>"""); }
testJoiningText
301,075
void (String s1, String s2, FileType fileType) { offset = s1.length(); doc = new DocumentImpl(s1 + s2); editor = (EditorEx)EditorFactory.getInstance().createEditor(doc); SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null); assert syntaxHighlighter != null; highlighter = new LexerEditorHighlighter(syntaxHighlighter, EditorColorsManager.getInstance().getGlobalScheme()); editor.setHighlighter(highlighter); }
configure
301,076
void () { configure("<root><tag attr=\"", "value\"/></root>", XmlFileType.INSTANCE); runTest(() -> { doc.insertString(offset, "q"); doc.insertString(offset + 1, "q"); }); }
testRecoveryAfterAttributeModification
301,077
void () { configure(""" <html:form action="/arquivo/associar"> <html:hidden property="idAcao"/> """, "<html:hidden property=\"possuiMensagem\"/>\n" + "</html:form>", XHtmlFileType.INSTANCE); runTest(() -> doc.insertString(offset, "\n")); }
testRecoveryInXHTML
301,078
void () { // Found by XmlCodeInsightSanityTest.testIncrementalHighlighterUpdate configure("<idea-plugin><name>Remote", " Interpreter</name></idea-plugin>", XmlFileType.INSTANCE); runConsistencyTest( () -> { // Wrapping ' Interpreter'. Note space in front doc.insertString(offset, "${"); doc.insertString(offset + 14, "}"); }); }
testWrappedWithEL
301,079
void () { // Found by XmlCodeInsightSanityTest.testIncrementalHighlighterUpdate //noinspection TextBlockMigration configure("<!DOCTYPE faces-config PUBLIC\n" + " \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN", "\"\n" + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n" + "<faces-config>\n" + "</faces-config>\n", XmlFileType.INSTANCE); runConsistencyTest( () -> { doc.deleteString(offset, doc.getTextLength()); // Remove everything after 'EN', leave string unfinished doc.insertString(offset - 25, "\""); // Close string in the middle }); }
testUnfinishedStringInDoctype
301,080
void () { configure("<a></a>\n<!--", "", XHtmlFileType.INSTANCE); CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> doc.insertString(offset, " -")), "", null); List<IElementType> newTokens = EditorTestUtil.getAllTokens(highlighter); assertSame("Detecting wrong char in comment data", XmlTokenType.XML_BAD_CHARACTER, newTokens.get(newTokens.size() - 1)); }
testUnclosedCommentAtEnd
301,081
void (Runnable action) { List<IElementType> oldTokens = EditorTestUtil.getAllTokens(highlighter); CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(action), "", null); List<IElementType> newTokens = EditorTestUtil.getAllTokens(highlighter); assertEquals(oldTokens, newTokens); }
runTest
301,082
void (Runnable action) { CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(action), "", null); CheckHighlighterConsistency.performCheck(editor); }
runConsistencyTest
301,083
void () { XMLCatalogManager manager = new XMLCatalogManager(getTestDataPath() + "relative.properties"); CatalogManager catalogManager = manager.getManager(); Vector files = catalogManager.getCatalogFiles(); assertEquals(1, files.size()); String filePath = (String)files.get(0); assertTrue(filePath, filePath.endsWith("catalog.xml")); String resolve = getManager().resolve("-//W3C//DTD XHTML 1.0 Strict//EN"); assertNotNull(resolve); assertTrue(resolve, resolve.endsWith("/catalog/xhtml1-strict.dtd")); }
testRelativeCatalogs
301,084
void () { String resolve = getManager().resolve("-//W3C//DTD XHTML 1.0 Strict//EN"); assertNotNull(resolve); assertTrue(resolve, resolve.endsWith("/catalog/xhtml1-strict.dtd")); }
testResolvePublic
301,085
void () { String resolve = getManager().resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"); assertNotNull(resolve); assertTrue(resolve, resolve.endsWith("/catalog/xhtml1-strict.dtd")); }
testResolveSystem
301,086
void () { String resolve = getManager().resolve("test-node.xsl"); assertNotNull(resolve); assertEquals("file:/C:/temp/catalog-test/library/test-node.xsl", resolve); }
testResolveUri
301,087
void () { myFixture.configureByFile("policy.xml"); List<HighlightInfo> infos = myFixture.doHighlighting(); assertSize(27, infos); String expectedUrn = "urn:oasis:names:tc:xacml:1.0:policy"; boolean hasUrn = false; for (HighlightInfo info : infos) { String text = info.getText(); assertOneOf(text, "x", expectedUrn); hasUrn |= expectedUrn.equals(text); } assertTrue(hasUrn); }
testHighlighting
301,088
void () { myFixture.configureByFile("policy.xml"); try { ExternalResourceManagerEx.getInstanceEx().setCatalogPropertiesFile(getTestDataPath() + "catalog.properties"); myFixture.checkHighlighting(); } finally { ExternalResourceManagerEx.getInstanceEx().setCatalogPropertiesFile(null); } }
testFixedHighlighting
301,089
void () { assertFalse(new XMLCatalogConfigurable().isModified()); }
testConfigurable
301,090
XMLCatalogManager () { return new XMLCatalogManager(getTestDataPath() + "catalog.properties"); }
getManager
301,091
String () { return "/xml/tests/testData/catalog/"; }
getBasePath
301,092
boolean () { return true; }
isCommunity
301,093
void () { doUnusedDeclarationTest( "<all xmlns=\"http://www.w3.org/2001/XMLSchema\" <warning descr=\"Namespace declaration is never used\">xmlns:xsi=\"http://www.w3.org/2001/XMLSc<caret>hema-instance\"</warning>/>", "<all xmlns=\"http://www.w3.org/2001/XMLSchema\"/>", XmlAnalysisBundle.message("xml.quickfix.remove.unused.namespace.decl")); }
testUnusedNamespaces
301,094
void () { doTestUnusedDefaultNamespace(); }
testUnusedDefaultNamespace
301,095
void () { doUnusedDeclarationTest(""" <schema:schema\s xmlns:schema="http://www.w3.org/2001/XMLSchema" <warning descr="Namespace declaration is never used">xmlns="http://www.w3.org/2001/X<caret>Include"</warning> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <warning descr="Namespace location is never used">xsi:noNamespaceSchemaLocation="http://www.w3.org/2001/XInclude"</warning>> </schema:schema>""", """ <schema:schema xmlns:schema="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > </schema:schema>""", XmlAnalysisBundle.message("xml.quickfix.remove.unused.namespace.decl"), false); doOptimizeImportsTest(""" <schema:schema\s xmlns:schema="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > </schema:schema>"""); }
doTestUnusedDefaultNamespace
301,096
void () { doUnusedDeclarationTest( """ <x:all <warning descr="Namespace declaration is never used">xmlns="http://www.w3.org/2001/XMLS<caret>chema"</warning> xmlns:x="http://www.w3.org/2001/XMLSchema" <warning descr="Namespace declaration is never used">xmlns:y="http://www.w3.org/2001/XMLSchema"</warning>/>""", """ <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:y="http://www.w3.org/2001/XMLSchema"/>""", XmlAnalysisBundle.message("xml.quickfix.remove.unused.namespace.decl"), false); doOptimizeImportsTest(""" <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" />"""); }
testDifferentPrefixes
301,097
void () { doUnusedDeclarationTest(""" <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="<warning descr="Namespace location is never used">http://www.w3.org/2001/XML<caret>Sche</warning> <warning descr="Namespace location is never used">http://www.w3.org/2001/XMLSchema.xsd</warning>"/>""", """ <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />""", XmlAnalysisBundle.message("xml.intention.remove.unused.namespace.location")); }
testUnusedLocation
301,098
void () { doUnusedDeclarationTest(""" <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" <warning descr="Namespace declaration is never used">xmlns:y="http://www.w3.org/2001/XInclude"</warning> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="<warning descr="Namespace location is never used">http://www.w3.org/2001/XI<caret>nclude</warning> <warning descr="Namespace location is never used">http://www.w3.org/2001/XInclude.xsd</warning> http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"/>""", """ <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"/>""", XmlAnalysisBundle.message("xml.quickfix.remove.unused.namespace.decl")); }
testUnusedLocationOnly
301,099
void () { doUnusedDeclarationTest(""" <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <warning descr="Namespace location is never used">xsi:noNamespaceSc<caret>hemaLocation="<error descr="Cannot resolve file 'zzz'">zzz</error>"</warning> />""", """ <x:all xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />""", XmlAnalysisBundle.message("xml.intention.remove.unused.namespace.location")); }
testUnusedDefaultLocation