diff --git a/platform/platform-tests/testSrc/com/intellij/ui/tree/TreeSmartSelectProviderTest.java b/platform/platform-tests/testSrc/com/intellij/ui/tree/TreeSmartSelectProviderTest.java index 266d686b44c9..822f435c2866 100644 --- a/platform/platform-tests/testSrc/com/intellij/ui/tree/TreeSmartSelectProviderTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ui/tree/TreeSmartSelectProviderTest.java @@ -49,6 +49,85 @@ public class TreeSmartSelectProviderTest { } } + private void testDecreaseDoNotClearSelection(int row, String expected) { + test(tree -> { + select(tree, row); + testDecrease(tree, expected, expected); + }); + test(TreeSelectionModel.SINGLE_TREE_SELECTION, tree -> { + select(tree, row); + testDecrease(tree, expected, expected); + }); + } + + @Test + public void testDecreaseFromLeafNode() { + testDecreaseDoNotClearSelection(10, "-Root\n" + + " -Color\n" + + " Red\n" + + " Green\n" + + " Blue\n" + + " +Digit\n" + + " -Letter\n" + + " -Greek\n" + + " Alpha\n" + + " Beta\n" + + " [Gamma]\n" + + " Delta\n" + + " Epsilon\n"); + } + + @Test + public void testDecreaseFromCollapsedNode() { + testDecreaseDoNotClearSelection(5, "-Root\n" + + " -Color\n" + + " Red\n" + + " Green\n" + + " Blue\n" + + " +[Digit]\n" + + " -Letter\n" + + " -Greek\n" + + " Alpha\n" + + " Beta\n" + + " Gamma\n" + + " Delta\n" + + " Epsilon\n"); + } + + @Test + public void testDecreaseFromExpandedNode() { + testDecreaseDoNotClearSelection(7, "-Root\n" + + " -Color\n" + + " Red\n" + + " Green\n" + + " Blue\n" + + " +Digit\n" + + " -Letter\n" + + " -[Greek]\n" + + " Alpha\n" + + " Beta\n" + + " Gamma\n" + + " Delta\n" + + " Epsilon\n"); + } + + @Test + public void testDecreaseFromExpandedParentNode() { + testDecreaseDoNotClearSelection(6, "-Root\n" + + " -Color\n" + + " Red\n" + + " Green\n" + + " Blue\n" + + " +Digit\n" + + " -[Letter]\n" + + " -Greek\n" + + " Alpha\n" + + " Beta\n" + + " Gamma\n" + + " Delta\n" + + " Epsilon\n"); + } + @Test public void testIcreaseToVisibleRoot() { test(true, tree -> {