summaryrefslogtreecommitdiff
path: root/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java')
-rw-r--r--platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java
index 5dd8bbb8c424..fd774b5e817d 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/AbstractEditorTest.java
@@ -34,6 +34,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.regex.MatchResult;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.junit.Assert.assertArrayEquals;
@@ -94,6 +95,20 @@ public abstract class AbstractEditorTest extends LightPlatformCodeInsightTestCas
));
}
+ protected static void foldOccurrences(String textToFoldRegexp, final String placeholder) {
+ final Matcher matcher = Pattern.compile(textToFoldRegexp).matcher(myEditor.getDocument().getCharsSequence());
+ myEditor.getFoldingModel().runBatchFoldingOperation(new Runnable() {
+ @Override
+ public void run() {
+ while(matcher.find()) {
+ FoldRegion foldRegion = myEditor.getFoldingModel().addFoldRegion(matcher.start(), matcher.end(), placeholder);
+ assertNotNull(foldRegion);
+ foldRegion.setExpanded(false);
+ }
+ }
+ });
+ }
+
/**
* Setups document of the {@link #getEditor() current editor} according to the given text that is expected to contain
* information about document lines obtained from the {@link DocumentImpl#dumpState()}.