Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
272,100 | void () { LOG.debug("Seed is " + mySeed); int i = 0; try { for (i = 0; i < RANDOM_ITERATIONS; i++) { ourActions.get(myRandom.nextInt(ourActions.size())).run(); validateSums(); } } catch (Throwable t) { String message = "Failed when run with seed=" + mySeed + " in iteration " + i; System.err.println(message); throw new RuntimeException(message, t); } } | testStressByRandomOperations |
272,101 | void () { List<MyRange> markers = getAllMarkers(); SortedMap<Integer, Integer> allValues = new TreeMap<>(); for (MyRange marker : markers) { int offset = marker.getStartOffset(); Integer sumForOffset = allValues.get(offset); int value = marker.myValue; allValues.put(offset, sumForOffset == null ? value : sumForOffset + value); } int runningSum = 0; int prevOffset = Integer.MIN_VALUE; for (Map.Entry<Integer, Integer> e : allValues.entrySet()) { int offset = e.getKey(); if (prevOffset < (offset - 1)) checkSumForOffset(offset - 1, runningSum); runningSum += e.getValue(); checkSumForOffset(offset, runningSum); prevOffset = offset; } checkSumForOffset(prevOffset + 1, runningSum); } | validateSums |
272,102 | void (int offset, int expectedSum) { assertEquals(expectedSum, myTree.getSumOfValuesUpToOffset(offset)); } | checkSumForOffset |
272,103 | List<MyRange> () { List<MyRange> result = new ArrayList<>(); myTree.processAll(result::add); return result; } | getAllMarkers |
272,104 | void () { myTree.removeInterval(this); } | dispose |
272,105 | int () { return myValue; } | getAsInt |
272,106 | void (int newValue) { myValue = newValue; myTree.valueUpdated(this); } | setValue |
272,107 | void () { new MyRange(myRandom.nextInt(myDocument.getTextLength() + 1), myRandom.nextInt(MAX_VALUE), myRandom.nextBoolean()); } | run |
272,108 | void () { List<MyRange> allMarkers = getAllMarkers(); if (!allMarkers.isEmpty()) { allMarkers.get(myRandom.nextInt(allMarkers.size())).dispose(); } } | run |
272,109 | void () { List<MyRange> allMarkers = getAllMarkers(); if (!allMarkers.isEmpty()) { allMarkers.get(myRandom.nextInt(allMarkers.size())).setValue(myRandom.nextInt(MAX_VALUE)); } } | run |
272,110 | void () { int offset = myRandom.nextInt(myDocument.getTextLength() + 1); runWriteCommand(() -> myDocument.insertString(offset, StringUtil.repeat(" ", myRandom.nextInt(MAX_CHARS_PER_OPERATION) + 1))); } | run |
272,111 | void () { int textLength = myDocument.getTextLength(); if (textLength <= 0) return; int offset = myRandom.nextInt(textLength); runWriteCommand(() -> myDocument.deleteString(offset, Math.min(textLength, offset + 1 + myRandom.nextInt(MAX_CHARS_PER_OPERATION)))); } | run |
272,112 | void () { int textLength = myDocument.getTextLength(); if (textLength <= 0) return; int startOffset = myRandom.nextInt(textLength); int endOffset = Math.min(textLength, startOffset + 1 + myRandom.nextInt(MAX_CHARS_PER_OPERATION)); int targetOffset = myRandom.nextInt(textLength + 1); if (targetOffset < startOffset || targetOffset > endOffset) { runWriteCommand(() -> myDocument.moveText(startOffset, endOffset, targetOffset)); } } | run |
272,113 | void () { String secondaryFont = getExistingNonDefaultFontName(); FontPreferences globalPrefs = AppEditorFontOptions.getInstance().getFontPreferences(); FontPreferences tempCopy = new FontPreferencesImpl(); globalPrefs.copyTo(tempCopy); try { init("blah", PlainTextFileType.INSTANCE); assertInstanceOf(globalPrefs, ModifiableFontPreferences.class); ((ModifiableFontPreferences)globalPrefs).register(secondaryFont, globalPrefs.getSize(globalPrefs.getFontFamily())); LOG.debug(dumpFontPreferences("globalPrefs", globalPrefs)); assertEquals(2, globalPrefs.getRealFontFamilies().size()); ((EditorEx)getEditor()).reinitSettings(); EditorColorsScheme editorScheme = getEditor().getColorsScheme(); assertInstanceOf(editorScheme, DelegateColorScheme.class); EditorColorsScheme delegate = ((DelegateColorScheme)editorScheme).getDelegate(); assertTrue(delegate.isUseAppFontPreferencesInEditor()); FontPreferences delegatePrefs = delegate.getFontPreferences(); assertEquals(globalPrefs.getRealFontFamilies(), delegatePrefs.getRealFontFamilies()); FontPreferences editorPrefs = editorScheme.getFontPreferences(); LOG.debug(dumpFontPreferences("editorPrefs", editorPrefs)); assertEquals(2, editorPrefs.getRealFontFamilies().size()); assertEquals(secondaryFont, editorPrefs.getRealFontFamilies().get(1)); } finally { tempCopy.copyTo(globalPrefs); } } | testSecondaryFontIsAvailable |
272,114 | String (@NotNull String message, @NotNull FontPreferences fontPreferences) { StringBuilder sb = new StringBuilder(); sb.append(message).append(": "); sb.append("Real font families: "); boolean isFirst = true; for (String fontFamily : fontPreferences.getRealFontFamilies()) { if (isFirst) isFirst = false; else sb.append(", "); sb.append(fontFamily); } return sb.toString(); } | dumpFontPreferences |
272,115 | void () { Document document = EditorFactory.getInstance().createDocument(""); doInEditor(document, e1 -> doInEditor(document, e2 -> { float initialSpacing = e1.getColorsScheme().getLineSpacing(); assertEquals(initialSpacing, e2.getColorsScheme().getLineSpacing()); e1.getColorsScheme().setLineSpacing(initialSpacing + 0.1f); assertFalse(initialSpacing == e1.getColorsScheme().getLineSpacing()); assertEquals(initialSpacing, e2.getColorsScheme().getLineSpacing()); })); } | testSettingLineSpacingAffectsOnlyCurrentEditor |
272,116 | void (@NotNull Document document, Consumer<? super Editor> task) { EditorFactory factory = EditorFactory.getInstance(); Editor editor = factory.createEditor(document); try { task.accept(editor); } finally { factory.releaseEditor(editor); } } | doInEditor |
272,117 | void () { myStorage = new TextChangesStorage(); } | setUp |
272,118 | void () { assertTrue(myStorage.isEmpty()); insert("abc", 2); assertFalse(myStorage.isEmpty()); assertEquals(1, myStorage.getChanges().size()); myStorage.clear(); assertTrue(myStorage.isEmpty()); assertTrue(myStorage.getChanges().isEmpty()); } | clear |
272,119 | void () { insert("abc", 2); checkChanges(c("abc", 2)); } | singleInsert |
272,120 | void () { String text = "this is a relatively long text"; insert(text, 2); checkChanges(c(text, 2)); } | singleLongInsert |
272,121 | void () { insert("abc", 2); insert("def", 6); insert("ghi", 11); checkChanges(c("abc", 2), c("def", 3), c("ghi", 5)); } | disconnectedInserts |
272,122 | void () { insert("abc", 10); insert("def", 1); checkChanges(c("def", 1), c("abc", 10)); } | disconnectedInsertsFromTailToStart |
272,123 | void () { insert("abc", 2); insert("def", 5); insert("ghi", 8); checkChanges(c("abcdefghi", 2)); } | adjacentInserts |
272,124 | void () { insert("abc", 2); insert("XY", 3); insert("1234", 4); checkChanges(c("aX1234Ybc", 2)); } | nestedInserts |
272,125 | void () { delete(2, 3); checkChanges(c("", 2, 3)); } | singleDelete |
272,126 | void () { delete(2, 3); delete(3, 4); delete(5, 6); checkChanges(c("", 2, 3), c("", 4, 5), c("", 7, 8)); } | disconnectedDeletes |
272,127 | void () { delete(2, 3); delete(2, 3); delete(2, 3); checkChanges(c("", 2, 5)); } | adjacentDeletes |
272,128 | void () { delete(5, 6); delete(4, 5); checkChanges(c("", 4, 6)); } | adjacentDeletesFromEndToStart |
272,129 | void () { replace("abc", 3, 4); checkChanges(c("abc", 3, 4)); } | singleReplace |
272,130 | void () { replace("abc", 3, 4); replace("de", 7, 8); replace("fghi", 10, 11); checkChanges(c("abc", 3, 4), c("de", 5, 6), c("fghi", 7, 8)); } | disconnectedReplaces |
272,131 | void () { replace("abc", 1, 4); replace("def", 10, 13); replace("ghi", 6, 9); checkChanges(c("abc", 1, 4), c("ghi", 6, 9), c("def", 10, 13)); } | disconnectedUnorderedReplaces |
272,132 | void () { replace("abc", 3, 4); replace("de", 6, 9); replace("fghi", 8, 9); checkChanges(c("abcdefghi", 3, 8)); } | adjacentReplaces |
272,133 | void () { replace("abc", 3, 4); replace("defg", 5, 6); replace("hi", 8, 11); checkChanges(c("abdefhi", 3, 6)); } | intersectedReplaces |
272,134 | void () { replace("abcd", 5, 6); replace("ef", 4, 7); replace("g", 1, 5); checkChanges(c("gfcd", 1, 6)); } | intersectedReplacesFromEndToStart |
272,135 | void () { replace("abcdef", 3, 5); replace("gh", 4, 7); replace("i", 5, 6); checkChanges(c("agief", 3, 5)); } | nestedReplaces |
272,136 | void () { replace("abc", 3, 4); replace("cde", 3, 6); replace("fg", 3, 6); checkChanges(c("fg", 3, 4)); } | exactMultipleReplace |
272,137 | void () { insert("abc", 3); delete(3, 6); checkChanges(); } | insertAndExactDelete |
272,138 | void () { insert("abc", 3); delete(4, 6); checkChanges(c("a", 3)); } | insertAndDeleteInTheMiddle |
272,139 | void () { insert("abc", 3); delete(2, 7); checkChanges(c("", 2, 4)); } | insertAndWiderDelete |
272,140 | void () { insert("abc", 3); delete(2, 5); checkChanges(c("c", 2, 3)); } | insertAndDeleteFromLeft |
272,141 | void () { insert("abc", 3); delete(4, 7); checkChanges(c("a", 3, 4)); } | insertAndDeleteFromRight |
272,142 | void () { insert("a", 1); insert("bcd", 3); insert("efg", 8); delete(3, 11); checkChanges(c("a", 1), c("", 2, 4)); } | disconnectedInsertsAndExactLinkingDelete |
272,143 | void () { insert("abc", 3); insert("def", 8); delete(2, 13); checkChanges(c("", 2, 7)); } | disconnectedInsertsAndWiderLinkingDelete |
272,144 | void () { insert("abc", 3); insert("def", 8); delete(4, 9); checkChanges(c("aef", 3, 5)); } | disconnectedInsertsAndNarrowLinkingDelete |
272,145 | void () { delete(72, 79); insert("a", 72); delete(72, 73); delete(64, 71); delete(51, 62); insert("a", 54); insert("a", 53); insert("a", 51); delete(56, 57); insert("b", 56); checkChanges(c("a", 51, 62), c("a", 64, 71), c("b", 72, 79)); } | replaceAndDeleteWholeTextFromItsStart |
272,146 | void () { insert("a", 1); insert("bcd", 3); insert("efg", 7); delete(3, 6); checkChanges(c("a", 1), c("efg", 3)); } | exactRemoveOfPreviousInsert |
272,147 | void () { insert("a", 1); insert("bc", 3); delete(2, 3); checkChanges(c("abc", 1, 2)); } | removeAdjacentToInsert |
272,148 | void (TextChangeImpl ... changes) { assertEquals(asList(changes), myStorage.getChanges()); assertEquals(changes.length > 0, !myStorage.isEmpty()); if (changes.length <= 0) { return; } int length = changes[changes.length - 1].getEnd() + 2; char[] input = new char[length]; char c = 'A'; for (int i = 0; i < input.length; i++) { input[i] = c++; } char[] output = BulkChangesMerger.INSTANCE.mergeToCharArray(input, input.length, asList(changes)); // charAt(). for (int i = 0; i < output.length; i++) { if (output[i] != myStorage.charAt(input, i)) { fail(String.format( "Detected incorrect charAt() processing. Original text: '%s', changes: %s, index: %d, expected: %c, actual: %c", new String(input), Arrays.asList(changes), i, output[i], myStorage.charAt(input, i) )); } } // substring(). for (int start = 0; start < output.length; start++) { for( int end = start; end < output.length; end++) { String expected = new String(output, start, end - start); String actual = myStorage.substring(input, start, end).toString(); if (!expected.equals(actual)) { fail(String.format( "Detected incorrect substring() processing. Original text: '%s', changes: %s, client text: '%s', range: %d-%d, " + "expected: '%s', actual: '%s'", new String(input), Arrays.asList(changes), new String(output), start, end, expected, actual )); } } } } | checkChanges |
272,149 | TextChangeImpl (@NotNull String text, int startOffset) { return c(text, startOffset, startOffset); } | c |
272,150 | TextChangeImpl (@NotNull String text, int startOffset, int endOffset) { return new TextChangeImpl(text, startOffset, endOffset); } | c |
272,151 | void (@NotNull String text, int offset) { myStorage.store(c(text, offset)); } | insert |
272,152 | void (int start, int end) { myStorage.store(c("", start, end)); } | delete |
272,153 | void (@NotNull String text, int start, int end) { myStorage.store(c(text, start, end)); } | replace |
272,154 | void () { EditorTextFieldRendererDocument document = new EditorTextFieldRendererDocument(); document.setText("12345\n67890\n\r12345\r11111"); assertEquals(5, document.getLineEndOffset(0)); assertEquals(6, document.getLineStartOffset(1)); assertEquals(11, document.getLineEndOffset(1)); assertEquals(12, document.getLineStartOffset(2)); assertEquals(12, document.getLineEndOffset(2)); assertEquals(13, document.getLineStartOffset(3)); assertEquals(18, document.getLineEndOffset(3)); } | testSelection |
272,155 | void () { List<? extends Action> actions = Arrays.asList(new AddText(), new RemoveText(), new ReplaceText(), new MoveText()); LOG.debug("Seed is " + mySeed); int i = 0; try { initText(""); for (i = 1; i <= ITERATIONS; i++) { doRandomAction(actions); checkConsistency(getEditor()); } } catch (Throwable t) { String message = "Failed when run with seed=" + mySeed + " in iteration " + i; System.err.println(message); throw new RuntimeException(message, t); } } | testRandomActions |
272,156 | void (List<? extends Action> actions) { actions.get(myRandom.nextInt(Arrays.asList(new AddText(), new RemoveText(), new ReplaceText(), new MoveText()).size())).perform(getEditor(), myRandom); } | doRandomAction |
272,157 | void (Editor editor) { checkLogicalPositionCache(editor); } | checkConsistency |
272,158 | void (Editor editor) { EditorViewAccessor.getView(editor).getLogicalPositionCache().validateState(); } | checkLogicalPositionCache |
272,159 | CharSequence (Random random) { int textLength = random.nextInt(10); StringBuilder b = new StringBuilder(); for (int i = 0; i < textLength; i++) { b.append(switch (random.nextInt(5)) { case 0 -> '\t'; case 1 -> '\n'; default -> ' '; }); } return b; } | generateText |
272,160 | void (Editor editor, Random random) { Document document = editor.getDocument(); int offset = random.nextInt(document.getTextLength() + 1); CharSequence text = generateText(random); WriteCommandAction.runWriteCommandAction(getProject(), () -> document.insertString(offset, text)); } | perform |
272,161 | void (Editor editor, Random random) { Document document = editor.getDocument(); int textLength = document.getTextLength(); if (textLength <= 0) return; int from = random.nextInt(textLength + 1); int to = random.nextInt(textLength + 1); WriteCommandAction.runWriteCommandAction(getProject(), () -> document.deleteString(Math.min(from, to), Math.max(from, to))); } | perform |
272,162 | void (Editor editor, Random random) { Document document = editor.getDocument(); int textLength = document.getTextLength(); if (textLength <= 0) return; int from = random.nextInt(textLength + 1); int to = random.nextInt(textLength + 1); CharSequence text = generateText(random); WriteCommandAction.runWriteCommandAction(getProject(), () -> document.replaceString(Math.min(from, to), Math.max(from, to), text)); } | perform |
272,163 | void (Editor editor, Random random) { Document document = editor.getDocument(); int textLength = document.getTextLength(); if (textLength <= 0) return; int[] offsets = {random.nextInt(textLength + 1), random.nextInt(textLength + 1), random.nextInt(textLength + 1)}; Arrays.sort(offsets); if (offsets[0] == offsets[1] || offsets[1] == offsets[2]) return; WriteCommandAction.runWriteCommandAction(getProject(), () -> { if (random.nextBoolean()) { ((DocumentEx)document).moveText(offsets[0], offsets[1], offsets[2]); } else { ((DocumentEx)document).moveText(offsets[1], offsets[2], offsets[0]); } }); } | perform |
272,164 | void () { assertCaretPositionsForGlyphVector( glyph(0, 10).glyph(10, 20).glyph(20, 30), 10, 20, 30 ); } | testSimpleText |
272,165 | void () { assertCaretPositionsForGlyphVector( rtl().glyph(0, 10).glyph(10, 20).glyph(20, 30), 10, 20, 30 ); } | testSimpleRtlText |
272,166 | void () { assertCaretPositionsForGlyphVector( glyph(0, 12).glyph(12, 12).glyph(12, 12), // ICU-style ligature (when all characters get a glyph) 4, 8, 12 ); } | testLigature |
272,167 | void () { assertCaretPositionsForGlyphVector( rtl().glyph(0, 0).glyph(0, 0).glyph(0, 12), // ICU-style ligature (when all characters get a glyph) 4, 8, 12 ); } | testRtlLigature |
272,168 | void () { assertCaretPositionsForGlyphVector( glyph(0, 12).noGlyph().noGlyph(), // Harfbuzz-style ligature (some characters don't map to glyphs) 4, 8, 12 ); } | testHbLigature |
272,169 | void () { assertCaretPositionsForGlyphVector( rtl().noGlyph().noGlyph().glyph(0, 12), // Harfbuzz-style ligature (some characters don't map to glyphs) 4, 8, 12 ); } | testHbRtlLigature |
272,170 | void () { assertCaretPositionsForGlyphVector( glyph(0, 8).noGlyph(), // Harfbuzz-style ligature (some characters don't map to glyphs) 4, 8 ); } | testHbLigatureTwoChars |
272,171 | void (MyGlyphVector gv, int... expectedPositions) { FontLayoutService.setInstance(new MockFontLayoutService(TEST_CHAR_WIDTH, TEST_LINE_HEIGHT, TEST_DESCENT) { @NotNull @Override public GlyphVector layoutGlyphVector(@NotNull Font font, @NotNull FontRenderContext fontRenderContext, char @NotNull [] chars, int start, int end, boolean isRtl) { return gv; } }); try { int length = gv.getNumChars(); char[] text = new char[length]; FontInfo fontInfo = new FontInfo(Font.MONOSPACED, 1, Font.PLAIN, false, new FontRenderContext(null, false, false)); ComplexTextFragment fragment = new ComplexTextFragment(text, 0, length, (gv.getLayoutFlags() & GlyphVector.FLAG_RUN_RTL) != 0, fontInfo); int[] charPositions = new int[length]; for (int i = 0; i < length; i++) { charPositions[i] = (int)fragment.visualColumnToX(0, i + 1); } assertArrayEquals(expectedPositions, charPositions); } finally { FontLayoutService.setInstance(null); } } | assertCaretPositionsForGlyphVector |
272,172 | GlyphVector (@NotNull Font font, @NotNull FontRenderContext fontRenderContext, char @NotNull [] chars, int start, int end, boolean isRtl) { return gv; } | layoutGlyphVector |
272,173 | MyGlyphVector () { return new MyGlyphVector(true, new Integer[0], new Integer[0]); } | rtl |
272,174 | MyGlyphVector (int xStart, int xEnd) { return new MyGlyphVector(false, new Integer[]{xStart}, new Integer[]{xEnd - xStart}); } | glyph |
272,175 | MyGlyphVector (int xStart, int xEnd) { return new MyGlyphVector(myRtl, ArrayUtil.append(myGlyphPositions, xStart), ArrayUtil.append(myGlyphWidths, xEnd - xStart)); } | glyph |
272,176 | MyGlyphVector () { return new MyGlyphVector(myRtl, ArrayUtil.append(myGlyphPositions, null), ArrayUtil.append(myGlyphWidths, null)); } | noGlyph |
272,177 | int () { return (int)Stream.of(myGlyphPositions).filter(Objects::nonNull).count(); } | getNumGlyphs |
272,178 | int () { return myGlyphPositions.length; } | getNumChars |
272,179 | Point2D (int glyphIndex) { boolean afterLast = glyphIndex == getNumGlyphs(); int index = getGlyphIndexInArray(glyphIndex - (afterLast ? 1 : 0)); return new Point(myGlyphPositions[index] + (afterLast ? myGlyphWidths[index] : 0), 0); } | getGlyphPosition |
272,180 | Shape (int glyphIndex) { int index = getGlyphIndexInArray(glyphIndex); return new Rectangle(myGlyphPositions[index], -TEST_DESCENT, myGlyphWidths[index], TEST_LINE_HEIGHT); } | getGlyphLogicalBounds |
272,181 | int (int glyphIndex) { int index = getGlyphIndexInArray(glyphIndex); return myRtl ? getNumChars() - 1 - index : index; } | getGlyphCharIndex |
272,182 | int (int glyphIndex) { int index = 0; for (int i = 0; i < myGlyphPositions.length; i++) { if (myGlyphPositions[i] != null && index++ == glyphIndex) return i; } return -1; } | getGlyphIndexInArray |
272,183 | int () { return myRtl ? GlyphVector.FLAG_RUN_RTL : 0; } | getLayoutFlags |
272,184 | void () { initText("abcdefghij"); addCollapsedFoldRegion(1, 8, "..."); configureSoftWraps(4); verifySoftWrapPositions(8); VisualLinesIterator it = createIterator(0); assertFalse(it.atEnd()); assertEquals(0, it.getVisualLineStartOffset()); assertEquals(0, it.getStartFoldingIndex()); it.advance(); assertFalse(it.atEnd()); assertEquals(8, it.getVisualLineStartOffset()); assertEquals(1, it.getStartFoldingIndex()); } | testWrapAfterFolding |
272,185 | void () { initText("abc\ndef"); addCollapsedFoldRegion(3, 4, "..."); configureSoftWraps(6); verifySoftWrapPositions(4); VisualLinesIterator it = createIterator(0); assertFalse(it.atEnd()); it.advance(); assertFalse(it.atEnd()); it.advance(); assertTrue(it.atEnd()); } | testWrapAtFoldedLineBreak |
272,186 | void () { initText(""); VisualLinesIterator it = createIterator(0); assertFalse(it.atEnd()); assertEquals(0, it.getVisualLine()); assertEquals(0, it.getVisualLineStartOffset()); assertEquals(0, it.getVisualLineEndOffset()); assertEquals(0, it.getStartLogicalLine()); assertEquals(0, it.getEndLogicalLine()); it.advance(); assertTrue(it.atEnd()); } | testEmptyDocument |
272,187 | VisualLinesIterator (int startVisualLine) { return new VisualLinesIterator((EditorImpl)getEditor(), startVisualLine); } | createIterator |
272,188 | void () { doTestSoftWraps(10, "<fold text='veryVeryVeryLongPlaceholder'>foo</fold>"); } | testCollapsedRegionWithLongPlaceholderAtLineStart1 |
272,189 | void () { doTestSoftWraps(10, "<fold text='veryVeryVeryLongPlaceholder'>foo</fold><wrap>bar"); } | testCollapsedRegionWithLongPlaceholderAtLineStart2 |
272,190 | void () { doTestSoftWraps(10, "<fold text='veryVeryVeryLongPlaceholder'>foo</fold>\nvery long <wrap>text"); } | testCollapsedRegionWithLongPlaceholderAtLineStart3 |
272,191 | void () { doTestSoftWraps(10, "start<fold text='.....'>text with space</fold><wrap>end"); } | testNoWrapInsideFoldRegion |
272,192 | void (int wrapWidth, String text) { List<MyFoldRegion> foldRegions = new ArrayList<>(); List<Integer> wrapPositions = new ArrayList<>(); int foldInsertPosition = 0; int pos = 0; int docPos = 0; Matcher matcher = Pattern.compile(TAGS_PATTERN).matcher(text); StringBuilder cleanedText = new StringBuilder(); while(matcher.find()) { cleanedText.append(text, pos, matcher.start()); docPos += matcher.start() - pos; pos = matcher.end(); if (matcher.group(1) != null) { // <fold> foldRegions.add(foldInsertPosition++, new MyFoldRegion(docPos, matcher.group(3), matcher.group(2) != null)); } else if (matcher.group(4) != null) { // </fold> assertTrue("Misplaced closing fold marker tag: " + text, foldInsertPosition > 0); foldRegions.get(--foldInsertPosition).endPos = docPos; } else { // <wrap> wrapPositions.add(docPos); } } assertTrue("Missing closing fold marker tag: " + text, foldInsertPosition == 0); cleanedText.append(text.substring(pos)); init(cleanedText.toString(), PlainTextFileType.INSTANCE); for (MyFoldRegion region : foldRegions) { FoldRegion r = addFoldRegion(region.startPos, region.endPos, region.placeholder); if (region.collapse) { toggleFoldRegionState(r, false); } } EditorTestUtil.configureSoftWraps(getEditor(), wrapWidth); List<Integer> actualWrapPositions = new ArrayList<>(); for (SoftWrap wrap : getEditor().getSoftWrapModel().getSoftWrapsForRange(0, getEditor().getDocument().getTextLength())) { actualWrapPositions.add(wrap.getStart()); } assertEquals("Wrong wrap positions", wrapPositions, actualWrapPositions); } | doTestSoftWraps |
272,193 | void () { new TextChangeImpl("", -1); } | negativeStartIndex |
272,194 | void () { new TextChangeImpl("", 0, -1); } | negativeEndIndex |
272,195 | void () { new TextChangeImpl("", 2, 1); } | inconsistentIndices |
272,196 | void () { int start = 1; int end = 10; String text = "test"; TextChange textChange = new TextChangeImpl(text, start, end); assertTrue(StringUtil.equals(text, textChange.getText())); assertArrayEquals(text.toCharArray(), textChange.getChars()); assertEquals(start, textChange.getStart()); assertEquals(end, textChange.getEnd()); } | propertiesExposing |
272,197 | void () { new TextChangeImpl("", 1, 2).advance(-2); } | advanceToNegativeOffset |
272,198 | void () { TextChangeImpl base = new TextChangeImpl("xyz", 3, 5); int[] offsets = {5, 0, -3}; for (int offset : offsets) { int start = base.getStart(); int end = base.getEnd(); base.advance(offset); assertEquals(new TextChangeImpl(base.getText(), start + offset, end + offset), base); } } | advance |
272,199 | void () { JLabel label = new JLabel(); checkInstallUninstall(1, BOLD_ITALIC_FONT.install(label)); checkInstallUninstall(1, MONOSPACED_FONT.install(label)); checkInstallUninstall(0, RelativeFont.uninstallFrom(label)); checkInstallUninstall(0, RelativeFont.uninstallFrom(label)); } | testInstallUninstall |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.