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:
Denis.Zhdanov
2012-06-25 12:58:29 +04:00
parent 4ab8985841
commit 2c673be3aa
4 changed files with 36 additions and 12 deletions
@@ -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)