mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-82338 "Collapse All" Collapses only comments
1. Fixed the problem (fold regions were registered in random order but the model expected them to be sorted); 2. Corresponding test is added; 3. Green code policy;
This commit is contained in:
@@ -365,6 +365,22 @@ class Test {
|
||||
assertTrue(fold('test1').expanded)
|
||||
assertFalse(fold('test2').expanded)
|
||||
}
|
||||
|
||||
public void testUnorderedFoldRegionsRegistration() {
|
||||
def text = '01234567'
|
||||
configure text
|
||||
def foldModel = myFixture.editor.foldingModel as FoldingModelImpl
|
||||
foldModel.runBatchFoldingOperation {
|
||||
def innerFold = foldModel.addFoldRegion(3, 5, '...')
|
||||
def outerFold = foldModel.addFoldRegion(2, 6, '...')
|
||||
innerFold.expanded = false
|
||||
outerFold.expanded = false
|
||||
}
|
||||
def folds = foldModel.fetchVisible()
|
||||
assertEquals(1, folds.length)
|
||||
assertEquals(2, folds[0].startOffset)
|
||||
assertEquals(6, folds[0].endOffset)
|
||||
}
|
||||
|
||||
private def configure(String text) {
|
||||
myFixture.configureByText("a.java", text)
|
||||
|
||||
Reference in New Issue
Block a user