Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
271,500
void () { initText("a<selection>b<caret></selection>c"); ((EditorEx)getEditor()).setStickySelection(true); executeAction(IdeActions.ACTION_EDITOR_SWAP_SELECTION_BOUNDARIES); left(); checkResultByText("<selection><caret>ab</selection>c"); }
testSwapSelectionBoundariesWithStickySelection
271,501
void () { initText("a\n<selection>b\n</selection>c"); executeAction(IdeActions.ACTION_EDITOR_DUPLICATE_LINES); checkResultByText("a\nb\n<selection>b\n</selection>c"); }
testDuplicateLinesWhenSelectionEndsAtLineStart
271,502
void () { initText("a<selection>b\nc</selection>d"); executeAction(IdeActions.ACTION_EDITOR_DUPLICATE_LINES); checkResultByText("ab\ncd\n<selection>ab\ncd</selection>"); }
testDuplicateLinesAtTheEndOfTheDocument
271,503
void () { initText("a\n#"); getEditor().getDocument().createGuardedBlock(1, 3); executeAction(IdeActions.ACTION_EDITOR_DUPLICATE_LINES); checkResultByText("a\na\n#"); }
testDuplicateLineWithGuardedBlock
271,504
void () { initText(" text with [multiline\nfold region]<caret>"); foldOccurrences("(?s)\\[.*\\]", "..."); getEditor().getSettings().setSmartHome(true); home(); checkResultByText(" <caret>text with [multiline\nfold region]"); }
testSmartHomeAfterFoldedRegion
271,505
void () { init("<selection>\u00df</selection>", PlainTextFileType.INSTANCE); executeAction(IdeActions.ACTION_EDITOR_TOGGLE_CASE); checkResultByText("<selection>SS</selection>"); }
testToggleCaseForEszett
271,506
void () { initText("a\nb\nc"); executeAction(IdeActions.ACTION_SELECT_ALL); executeAction(IdeActions.ACTION_EDITOR_JOIN_LINES); checkResultByText("a b c"); }
testJoinSeveralLinesAtDocumentEnd
271,507
void () { initText("a<caret>" + SURROGATE_PAIR + "b"); delete(); checkResultByText("a<caret>b"); }
testDeleteAtSurrogatePair
271,508
void () { initText("a" + SURROGATE_PAIR + "<caret>b"); backspace(); checkResultByText("a<caret>b"); }
testBackspaceAtSurrogatePair
271,509
void () { initText("<caret>\ta"); getEditor().getSettings().setCaretInsideTabs(true); right(); backspace(); checkResultByText("<caret>\ta"); assertEquals(new LogicalPosition(0, 1), getEditor().getCaretModel().getLogicalPosition()); }
testBackspaceInsideVirtualTab
271,510
void () { initText("a<caret>" + SURROGATE_PAIR + "b"); right(); checkResultByText("a" + SURROGATE_PAIR + "<caret>b"); left(); checkResultByText("a<caret>" + SURROGATE_PAIR + "b"); }
testCaretMovementNearSurrogatePair
271,511
void () { initText("foo\nba<caret>r\nbaz"); executeAction(IdeActions.ACTION_EDITOR_SORT_LINES); checkResultByText("ba<caret>r\nbaz\nfoo"); }
testSortLinesNoSelection
271,512
void () { initText("<selection>foo\nbar\n<caret></selection>baz"); executeAction(IdeActions.ACTION_EDITOR_SORT_LINES); checkResultByText("<selection>bar\nfoo\n<caret></selection>baz"); }
testSortLinesWithSelection
271,513
void () { initText("foo\nba<caret>r\nbaz\n"); executeAction(IdeActions.ACTION_EDITOR_SORT_LINES); checkResultByText("ba<caret>r\nbaz\nfoo\n"); }
testLastEmptyLineIsNotTouchedBySort
271,514
void () { initText("foo\nbar\nba<caret>z"); executeAction(IdeActions.ACTION_EDITOR_REVERSE_LINES); checkResultByText("ba<caret>z\nbar\nfoo"); }
testReverseLinesNoSelection
271,515
void () { initText("<selection>foo\nbar\n<caret></selection>baz"); executeAction(IdeActions.ACTION_EDITOR_REVERSE_LINES); checkResultByText("<selection>bar\nfoo\n<caret></selection>baz"); }
testReverseLinesWithSelection
271,516
void () { initText("foo\nbar\n<caret>"); executeAction(IdeActions.ACTION_EDITOR_REVERSE_LINES); checkResultByText("bar\nfoo\n<caret>"); }
testReverseLinesNoSelectionSpecialCase
271,517
void () { initText("\nabc<caret>"); addCollapsedFoldRegion(0, 4, "..."); executeAction(IdeActions.ACTION_EDITOR_MOVE_LINE_START); checkResultByText("<caret>\nabc"); }
testLineStartForASpecificFoldingCase
271,518
void () { initText("line1\nline2\nline3\nline4\nline5<caret>\n"); addBlockInlay(getEditor().getDocument().getText().indexOf("line5"), true, 0, getEditor().getLineHeight() * 5); setEditorVisibleSize(100, 3); getEditor().getScrollingModel().scrollVertically(getEditor().visualLineToY(getEditor().getCaretModel().getVisualP...
testPageUpWithInlay
271,519
void () { initText("line1<caret>\nline2\nline3\nline4\nline5\n"); addBlockInlay(0, false, 0, getEditor().getLineHeight() * 5); setEditorVisibleSize(100, 3); getEditor().getScrollingModel().scrollVertically(0); executeAction(IdeActions.ACTION_EDITOR_MOVE_CARET_PAGE_DOWN); checkResultByText("line1\nline2<caret>\nline3\nl...
testPageDownWithInlay
271,520
void () { initText("<selection>line1\nline2\nline3<caret></selection>"); executeAction(IdeActions.ACTION_EDITOR_ADD_CARET_PER_SELECTED_LINE); checkResultByText("line1<caret>\nline2<caret>\nline3<caret>"); }
testAddCaretPerSelectedLine
271,521
void () { initText("<selection>line1\nline2\n<caret></selection>line3"); executeAction(IdeActions.ACTION_EDITOR_ADD_CARET_PER_SELECTED_LINE); checkResultByText("line1<caret>\nline2<caret>\nline3"); }
testAddCaretPerSelectedLineWholeLinesSelection
271,522
void () { initText("<selection>line1\nline2\nli<caret></selection>ne3"); executeAction(IdeActions.ACTION_EDITOR_ADD_CARET_PER_SELECTED_LINE); checkResultByText("line1<caret>\nline2<caret>\nline3<caret>"); }
testAddCaretPerSelectedLineIncompleteSelection
271,523
void () { JBTextArea area = new JBTextArea("text \u00df text"); TextComponentEditorImpl editor = new TextComponentEditorImpl(getProject(), area); area.select(0, 4); executeAction(IdeActions.ACTION_EDITOR_TOGGLE_CASE, editor); assertEquals("TEXT ß text", area.getText()); assertEquals(0, area.getSelectionStart()); assert...
testTextComponentEditor
271,524
void () { TextAttributes attributes = new TextAttributes(); TextAttributes otherAttributes = new TextAttributes(); TextAttributes merge = TextAttributes.merge(attributes, otherAttributes); assertEquals(attributes, merge); }
testMergeDefaultAttributes
271,525
void () { Color sampleColor = new Color(0, 0, 255); EditorColorPalette palette = getAllColorsPalette("Default"); Color nonConflictingColor = palette.getClosestNonConflictingColor(sampleColor); assertNotNull(nonConflictingColor); assertTrue(palette.getColors(EditorColorPalette.ORDER_NONE).contains(sampleColor)); assertF...
testGetNonConflictingColor
271,526
void () { final EditorColorsScheme colorsScheme = (EditorColorsScheme)EditorColorsManager.getInstance().getScheme("Default").clone(); final Color newColorInPalette = EditorColorPaletteFactory.getInstance().getPalette(colorsScheme, Language.ANY) .withBackgroundColors() .withForegroundColors() .getClosestNonConflictingCo...
testResolveConflictingColor
271,527
void (@NotNull EditorColorsScheme colorsScheme, @NotNull Color testColor, boolean needToBeReused) { assertNotNull(testColor); colorsScheme.setAttributes(RainbowHighlighter.RAINBOW_COLOR_KEYS[0], RainbowHighlighter.createRainbowAttribute(testColor)); final Color[] colors = RainbowHighlighter.testRainbowGenerateColors(co...
checkUsed
271,528
void (@NotNull String schemeName, int minIntensity, int maxIntensity) { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(schemeName); EditorColorPalette palette = EditorColorPaletteFactory.getInstance().getPalette(defaultScheme, Language.ANY).withBackgroundColors(); Collection<Color> color...
checkSchemeBackgrounds
271,529
EditorColorPalette (@NotNull String schemeName) { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(schemeName); return EditorColorPaletteFactory.getInstance().getPalette(defaultScheme, Language.ANY) .withBackgroundColors() .withForegroundColors(); }
getAllColorsPalette
271,530
void (@NotNull Collection<Color> colors, int minIntensity, int maxIntensity) { for (Color color : colors) { int intensity = (color.getRed() + color.getGreen() + color.getBlue()) / 3; assertTrue(color + " doesn't fit to intensity range [" + minIntensity + ".." + maxIntensity + "]", intensity >= minIntensity && intensity...
checkIntensity
271,531
void () { ModifiableFontPreferences appFontPrefs = (ModifiableFontPreferences)AppEditorFontOptions.getInstance().getFontPreferences(); FontPreferences stored = new FontPreferencesImpl(); appFontPrefs.copyTo(stored); try { String appFontName = appFontPrefs.getFontFamily(); int appFontSize = appFontPrefs.getSize(appFontN...
testAppLevelEditorFontDefaults
271,532
String (@NotNull String fontName) { return SystemInfo.isLinux && GraphicsEnvironment.isHeadless() && FontPreferences.LINUX_DEFAULT_FONT_FAMILY.equals(fontName) ? FontPreferences.FALLBACK_FONT_FAMILY : fontName; }
substLinuxFontName
271,533
void (@NotNull String fontName, int fontSize) { assertEquals(fontName, substLinuxFontName(myScheme.getEditorFontName())); assertEquals(fontSize, myScheme.getEditorFontSize()); assertEquals(fontName, substLinuxFontName(myScheme.getConsoleFontName())); assertEquals(fontSize, myScheme.getConsoleFontSize()); }
assertEditorFontsEqual
271,534
void () { myScheme.setFontPreferences(new FontPreferencesImpl()); FontPreferencesTest.checkState(myScheme.getFontPreferences(), Collections.emptyList(), Collections.emptyList(), FontPreferences.DEFAULT_FONT_NAME, FontPreferences.DEFAULT_FONT_NAME, null); String expectedName = FontPreferences.DEFAULT_FONT_NAME; assertEq...
testDefaults
271,535
void () { String fontName1 = FontPreferencesTest.getExistingNonDefaultFontName(); String fontName2 = FontPreferencesTest.getAnotherExistingNonDefaultFontName(); myScheme.setEditorFontName(fontName1); FontPreferences fontPreferences = myScheme.getFontPreferences(); assertInstanceOf(fontPreferences, ModifiableFontPrefere...
testSetFontPreferences
271,536
void () { String fontName1 = FontPreferencesTest.getExistingNonDefaultFontName(); String fontName2 = FontPreferencesTest.getAnotherExistingNonDefaultFontName(); myScheme.setEditorFontName(fontName1); myScheme.setConsoleFontName(fontName2); float scaledSize = UISettings.restoreFontSize((float)FontPreferences.DEFAULT_FON...
testSetName
271,537
void () { myScheme.setEditorFontSize(25); myScheme.setConsoleFontSize(21); FontPreferencesTest.checkState(myScheme.getFontPreferences(), Collections.singletonList(FontPreferences.DEFAULT_FONT_NAME), Collections.singletonList(FontPreferences.DEFAULT_FONT_NAME), FontPreferences.DEFAULT_FONT_NAME, FontPreferences.DEFAULT_...
testSetSize
271,538
void () { String fontName1 = FontPreferencesTest.getExistingNonDefaultFontName(); String fontName2 = FontPreferencesTest.getAnotherExistingNonDefaultFontName(); myScheme.setEditorFontName(fontName1); myScheme.setEditorFontSize(25); myScheme.setConsoleFontName(fontName2); myScheme.setConsoleFontSize(21); FontPreferences...
testSetNameAndSize
271,539
void () { String fontName1 = FontPreferencesTest.getExistingNonDefaultFontName(); String fontName2 = FontPreferencesTest.getAnotherExistingNonDefaultFontName(); myScheme.setEditorFontSize(25); myScheme.setEditorFontName(fontName1); myScheme.setConsoleFontSize(21); myScheme.setConsoleFontName(fontName2); FontPreferences...
testSetSizeAndName
271,540
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme scheme = (EditorColorsScheme)defaultScheme.clone(); scheme.setName("test"); scheme.setColor(ColorKey.createColorKey("BASE_COLOR"), new Color(0x80, 0x81, 0x82)); scheme.set...
testWriteColorWithAlpha
271,541
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme editorColorsScheme = (EditorColorsScheme)defaultScheme.clone(); editorColorsScheme.setName("test"); EditorColorSchemeTestCase.assertXmlOutputEquals( "<scheme name=\"test\"...
testWriteInheritedFromDefault
271,542
void () { EditorColorsScheme darculaScheme = EditorColorsManager.getInstance().getScheme("Darcula"); EditorColorsScheme editorColorsScheme = (EditorColorsScheme)darculaScheme.clone(); editorColorsScheme.setName("test"); EditorColorSchemeTestCase.assertXmlOutputEquals( "<scheme name=\"test\" version=\"142\" parent_schem...
testWriteInheritedFromDarcula
271,543
void () { Pair<EditorColorsScheme, TextAttributes> result = doTestWriteRead(DefaultLanguageHighlighterColors.STATIC_METHOD, AbstractColorsScheme.INHERITED_ATTRS_MARKER); TextAttributes fallbackAttrs = result.first.getAttributes(DefaultLanguageHighlighterColors.STATIC_METHOD.getFallbackAttributeKey()); assertSame(result...
testSaveInheritance
271,544
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); TextAttributes declarationAttrs = defaultScheme.getAttributes(DefaultLanguageHighlighterColors.IDENTIFIER).clone(); assertEquals(DefaultLanguageHighlighterColors.IDENTIFIER, DefaultLanguageH...
testSaveNoInheritanceAndDefaults
271,545
void () { Pair<EditorColorsScheme, TextAttributes> result = doTestWriteRead(DefaultLanguageHighlighterColors.INSTANCE_FIELD, AbstractColorsScheme.INHERITED_ATTRS_MARKER); TextAttributes fallbackAttrs = result.first.getAttributes(DefaultLanguageHighlighterColors.INSTANCE_FIELD.getFallbackAttributeKey()); TextAttributes ...
testSaveInheritanceForEmptyAttrs
271,546
void () { DefaultLogger.disableStderrDumping(getTestRootDisposable()); EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme editorColorsScheme = (EditorColorsScheme)defaultScheme.clone(); editorColorsScheme.setName("test"); TextAttrib...
testPreventCyclicTextAttributeDependency
271,547
void () { DefaultLogger.disableStderrDumping(getTestRootDisposable()); TextAttributesKey keyB = TextAttributesKey.createTextAttributesKey("B"); TextAttributesKey keyD = TextAttributesKey.createTextAttributesKey("D"); TextAttributesKey keyC = TextAttributesKey.createTextAttributesKey("C", keyD); try { keyC = TextAttribu...
testMustNotBePossibleToRegisterTextAttributeKeysWithDifferentFallBacks
271,548
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme parentScheme = (EditorColorsScheme)defaultScheme.clone(); parentScheme.setName("DefaultTest"); AbstractColorsScheme editorColorsScheme = new EditorColorsSchemeImpl(parentS...
testIdea152156
271,549
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme editorColorsScheme = (EditorColorsScheme)defaultScheme.clone(); editorColorsScheme.setName("rainbow"); final String BEGIN = """ <scheme name="rainbow" version="142" parent...
testWriteDefaultSemanticHighlighting
271,550
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); AbstractColorsScheme editorColorsScheme = (AbstractColorsScheme)defaultScheme.clone(); editorColorsScheme.setName("Test"); editorColorsScheme.setColor(EditorColors.TEARLINE_COLOR, new Color(...
testSettingsEqual
271,551
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme initialScheme = (EditorColorsScheme)defaultScheme.clone(); initialScheme.setLineSpacing(1.2f); initialScheme.setConsoleLineSpacing(1.0f); assertFalse(initialScheme.getLine...
testIdea188308
271,552
void () { ModifiableFontPreferences appPrefs = (ModifiableFontPreferences)AppEditorFontOptions.getInstance().getFontPreferences(); float currSpacing = appPrefs.getLineSpacing(); try { appPrefs.setLineSpacing(1.2f); EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT...
testNonDefaultConsoleLineSpacing
271,553
void () { EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME); EditorColorsScheme editorColorsScheme = (EditorColorsScheme)defaultScheme.clone(); editorColorsScheme.setColor(EditorColors.LINE_NUMBERS_COLOR, null); editorColorsScheme.setColor(EditorColor...
testEa124005
271,554
void () { checkState(Collections.emptyList(), Collections.emptyList(), FontPreferences.DEFAULT_FONT_NAME, FontPreferences.DEFAULT_FONT_NAME, null); }
testDefaults
271,555
void () { String fontName = getExistingNonDefaultFontName(); myPreferences.register(fontName, 25); checkState(Arrays.asList(fontName), Arrays.asList(fontName), fontName, fontName, 25); }
testRegisterExistingFont
271,556
void () { String fontName = getExistingNonDefaultFontName(); myPreferences.register(fontName, 25); String fontName2 = getAnotherExistingNonDefaultFontName(); myPreferences.register(fontName2, 13); checkState(Arrays.asList(fontName, fontName2), Arrays.asList(fontName, fontName2), fontName, fontName, 25, fontName2, 13); ...
testRegisterTwoExistingFonts
271,557
void () { String fontName = getNonExistingFontName(); myPreferences.register(fontName, 25); checkState(Arrays.asList(fontName), Arrays.asList(fontName), fontName, fontName, 25); }
testRegisterNonExistingFont
271,558
void () { String fontName = getExistingNonDefaultFontName(); myPreferences.addFontFamily(fontName); checkState(Arrays.asList(fontName), Arrays.asList(fontName), fontName, fontName, null); }
testAddExistingFont
271,559
void () { String fontName = getNonExistingFontName(); myPreferences.addFontFamily(fontName); checkState(Arrays.asList(fontName), Arrays.asList(fontName), fontName, fontName, null); }
testAddNonExistingFont
271,560
void (java.util.List<String> expectedRealFontFamilies, java.util.List<String> expectedEffectiveFontFamilies, String expectedFontFamily, Object... namesAndSizes) { checkState(myPreferences, expectedRealFontFamilies, expectedEffectiveFontFamilies, expectedFontFamily, namesAndSizes); // check object copying FontPreference...
checkState
271,561
void (FontPreferences fontPreferences, java.util.List<String> expectedRealFontFamilies, java.util.List<String> expectedEffectiveFontFamilies, String expectedFontFamily, Object... namesAndSizes) { assertEquals("Wrong real font families", expectedRealFontFamilies, fontPreferences.getRealFontFamilies()); assertEquals("Wro...
checkState
271,562
String () { return getExistingFontNameButNot(FontPreferences.DEFAULT_FONT_NAME); }
getExistingNonDefaultFontName
271,563
String () { String firstOne = getExistingFontNameButNot(FontPreferences.DEFAULT_FONT_NAME); return getExistingFontNameButNot(FontPreferences.DEFAULT_FONT_NAME, firstOne); }
getAnotherExistingNonDefaultFontName
271,564
String (String... names) { String[] fontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for (String name : fontFamilyNames) { if (name != null && !Arrays.asList(names).contains(name)) { return name; } } fail("Couldn't find existing font not in " + Arrays.toString(names)); ...
getExistingFontNameButNot
271,565
String () { return "DefinitelyNonExistingFontName"; }
getNonExistingFontName
271,566
TextAttributes (Element element) { return myReader.read(TextAttributes.class, element); }
read
271,567
String (String name, Object value) { return value(new Option(name, value == null ? null : value.toString())); }
value
271,568
String (Option... options) { StringBuilder sb = new StringBuilder("<value>"); for (Option option : options) { sb.append("\n\t").append(option); } return sb.append("\n</value>").toString(); }
value
271,569
String () { StringBuilder sb = new StringBuilder("<option"); for (Map.Entry<String, String> entry : myMap.entrySet()) { sb.append(' ').append(entry.getKey()).append('='); sb.append('"').append(entry.getValue()).append('"'); } return sb.append("/>").toString(); }
toString
271,570
void (@NonNls String before, @NonNls String after) { configureFromFileText("x.txt", before); type(' '); backspace(); stripTrailingSpaces(); checkResultByText(after); }
doTest
271,571
void () { WriteCommandAction.runWriteCommandAction(null, () -> { TrailingSpacesStripper.strip(getEditor().getDocument(), true, true); }); }
stripTrailingSpaces
271,572
void () { doTest("xxx\n <caret>\nyyy", "xxx\n <caret>\nyyy"); }
testDoNotStripModifiedOnCurrentLine
271,573
void () { doTest("xxx\n 222<caret> \nyyy", "xxx\n 222<caret>\nyyy"); }
testDoStripModifiedOnCurrentLineIfCaretWouldNotJump
271,574
void () { EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); settings.setEnsureNewLineAtEOF(true); configureFromFileText("x.txt", "xxx\n <caret>"); type(' '); FileDocumentManager.getInstance().saveAllDocuments(); checkResultByText("xxx\n <caret>\n"); }
testDoNotStripModifiedOnCurrentLastLine
271,575
void () { doTest("xxx\n <caret>\nyyy<caret> ", "xxx\n <caret>\nyyy<caret>"); }
testStrippingWithMultipleCarets
271,576
void () { configureFromFileText("x.txt", "xxx<caret>\nyyy"); type(' '); FocusEvent event = new FocusEvent(getEditor().getContentComponent(), 1005); FocusListener[] listeners = getEditor().getContentComponent().getListeners(FocusListener.class); for (FocusListener listener : listeners) { listener.focusLost(event); } str...
testModifyAndAltTabAway
271,577
void () { @NonNls String text = "xxx<caret> \nyyy "; configureFromFileText("x.txt", text); ((DocumentEx)getEditor().getDocument()).clearLineModificationFlags(); stripTrailingSpaces(); checkResultByText(text); type('z'); stripTrailingSpaces(); checkResultByText("xxxz<caret>\nyyy "); }
testOnlyModifiedLinesGetStripped
271,578
void () { configureFromFileText("x.txt", "xxx<caret> \nZ "); type(' '); getEditor().getCaretModel().moveToOffset(getEditor().getDocument().getText().indexOf('Z') + 1); type('Z'); stripTrailingSpaces(); checkResultByText("xxx\nZZ<caret>"); }
testOnlyModifiedLinesWhenDoesNotAllowCaretAfterEndOfLine
271,579
void () { configureFromFileText("x.txt", "xxx <caret>\nyyy\n"); type(' '); FileDocumentManager.getInstance().saveAllDocuments(); checkResultByText("xxx <caret>\nyyy\n"); // caret in the way getEditor().getCaretModel().moveToOffset(getEditor().getDocument().getText().indexOf("yyy")); FileDocumentManager.getInstance().sa...
testModifyLine_Save_MoveCaret_SaveAgain_ShouldStrip
271,580
void () { EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); settings.setStripTrailingSpaces(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE); configureFromFileText("x.txt", ""); type("xxx \nyyy \nzzz \n"); getEditor().getCaretModel().moveToOffset(0); end();end(); FileDocumentMa...
testDisableStrip_Modify_Save_EnableOnModifiedLines_Modify_Save_ShouldStripModifiedOnly
271,581
void () { EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); settings.setStripTrailingSpaces(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE); settings.setEnsureNewLineAtEOF(true); Document document = configureFromFileText("x.txt", "xxx <caret>\nyyy\n\t\t\t"); // make any modifi...
testDoNotStripModifiedLines_And_EnsureBlankLineAtTheEnd_LeavesWhitespacesAtTheEndOfFileAlone
271,582
void () { EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); settings.setStripTrailingSpaces(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED); Editor editor1 = createHeavyEditor("x1.txt", "x11 <caret>\nyyy\n"); Editor editor2 = createHeavyEditor("x2.txt", "x22 <caret>\nyyy\n"...
testModifySameLineInTwoFilesAndSaveAllShouldStripAtLeastOneFile
271,583
void () { EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); settings.setStripTrailingSpaces(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_WHOLE); settings.setKeepTrailingSpacesOnCaretLine(false); configureFromFileText( "x.txt", "xxx <caret>\nyyy " ); type(' '); backspace(); Editor...
testStripTrailingSpacesAtCaretLineOnExplicitSave
271,584
void () { EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); settings.setRemoveTrailingBlankLines(true); settings.setEnsureNewLineAtEOF(false); configureFromFileText( "x.txt", "xxx\nyyy\n\n\n\n\n\n\n<caret>\n" ); type(' '); FileDocumentManager.getInstance().saveAllDocuments(); checkResu...
testRemoveTrailingBlankLinesNoNewLine
271,585
void () { EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); settings.setRemoveTrailingBlankLines(true); settings.setEnsureNewLineAtEOF(true); configureFromFileText( "x.txt", "xxx\nyyy\n\n\n\n\n\n\n<caret>\n" ); type(' '); FileDocumentManager.getInstance().saveAllDocuments(); checkResul...
testRemoveTrailingBlankLinesNewLine
271,586
Editor (@NotNull String name, @NotNull String text) { VirtualFile myVFile = WriteAction.compute(() -> { try { VirtualFile file = getSourceRoot().createChildData(null, name); VfsUtil.saveText(file, text); return file; } catch (IOException e) { throw new RuntimeException(e); } }); final FileDocumentManager manager = File...
createHeavyEditor
271,587
void () { LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<>("TEXT", new TestAnnotator()); extension.setPluginDescriptor(new DefaultPluginDescriptor("DocumentMarkupModelTest")); ExtensionTestUtil.maskExtensions(LanguageAnnotators.EP_NAME, Collections.singletonList(extension), myFixture.getTestRo...
testInfoTestAttributes
271,588
void () { Document document = new DocumentImpl("line0\nline1\nline2"); MarkupModelEx model = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); RangeHighlighterEx highlighter = model.addPersistentLineHighlighter(null, 2, 0); WriteCommandAction.runWriteCommandAction(getProject(), () -> documen...
testPersistentHighlighterUpdateOnPartialDocumentUpdate
271,589
void () { Document document = new DocumentImpl("\n\n\n\n\n"); MarkupModelEx model = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); RangeHighlighter h = model.addLineHighlighter(2, 0, null); model.addPersistentLineHighlighter(2, 0, null); WriteCommandAction.runWriteCommandAction(getProject...
testUpdateOfPersistentAndNormalHighlightersIsIndependent
271,590
void () { Document document = new DocumentImpl("\n\n\n"); MarkupModelEx model = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); RangeHighlighter h = model.addPersistentLineHighlighter(null, 2, 0); assertTrue(h.isValid()); assertEquals(2, h.getStartOffset()); assertEquals(2, h.getEndOffset(...
testCorrectUpdateOfPersistentHighlighterAfterFarAwayChange
271,591
void () { Document document = new DocumentImpl("\n\n\n"); MarkupModelEx model = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); RangeHighlighter h1 = model.addPersistentLineHighlighter(null, 2, 0); RangeHighlighter h2 = model.addPersistentLineHighlighter(null, 2, 0); WriteCommandAction.run...
testAnotherIdenticalPersistentHighlighterDoesntChangeUpdate
271,592
void (@NotNull PsiElement element, @NotNull AnnotationHolder holder) { holder.newSilentAnnotation(HighlightSeverity.INFORMATION).create(); }
annotate
271,593
void () { PropertyChecker.customized() .withIterationCount(1_000) .checkScenarios(() -> env -> { Generator<String> strings = Generator.stringsOf("a \n\r"); String initialText = env.generateValue(strings, null); int start = env.generateValue(Generator.integers(0, initialText.length()), null); int end = env.generateValue...
testFuzzUpdate
271,594
void () { checkIncrementalUpdate("\n\r", 0, 0, ""); checkIncrementalUpdate("\r\n", 0, 1, ""); checkIncrementalUpdate("\r", 0, 0, "\r"); }
testSlashRIssues
271,595
void () { checkIncrementalUpdate("\n", 0, 1, ""); }
testClearSingleLineEnd
271,596
void (String initialText, int start, int end, String replacement) { CharSequence newText = StringUtil.replaceSubSequence(initialText, start, end, replacement); LineSet initial = LineSet.createLineSet(initialText); LineSet updated = initial.update(initialText, start, end, replacement, false); LineSet fresh = LineSet.cre...
checkIncrementalUpdate
271,597
void () { String longLine = StringUtil.repeat("a ", 200000); PlatformTestUtil.startPerformanceTest("Document changes in a long line", 1000, () -> { Document document = new DocumentImpl("a\n" + longLine + "<caret>" + longLine + "\n", true); for (int i = 0; i < 1000; i++) { int offset = i * 2 + longLine.length(); assertE...
testTypingInLongLinePerformance
271,598
void () { LOG.debug("Seed is " + mySeed); int i = 0; try { for (; i < ITERATIONS; i++) { Document document = new DocumentImpl(generateRandomSequence(), true, true); document.addDocumentListener(new ValidatingListener()); int o1 = myRandom.nextInt(document.getTextLength() + 1); int o2 = myRandom.nextInt(document.getText...
testRandomUpdates
271,599
CharSequence () { int textLength = myRandom.nextInt(MAX_TEXT_LENGTH); StringBuilder text = new StringBuilder(); for (int j = 0; j < textLength; j++) { text.append(CHARS_TO_USE.charAt(myRandom.nextInt(CHARS_TO_USE.length()))); } return text; }
generateRandomSequence