Created
September 15, 2013 13:52
-
-
Save Fuud/6570945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
/* @test | |
* @bug 6921688 | |
* @summary Lead selection index should be cleared after selection was erased | |
* @author Fedor Bobin | |
* @run main DefaultListSelectionModelTest | |
*/ | |
public class DefaultListSelectionModelTest { | |
public static void main(String[] args) { | |
final DefaultListSelectionModel defaultListSelectionModel = new DefaultListSelectionModel(); | |
defaultListSelectionModel.setSelectionInterval(0, 0); | |
if (defaultListSelectionModel.getLeadSelectionIndex() != 0) { | |
throw new AssertionError("Was selected only item 0 but lead selected index = " + | |
defaultListSelectionModel.getLeadSelectionIndex()); | |
} | |
defaultListSelectionModel.removeIndexInterval(0, 0); | |
if (!defaultListSelectionModel.isSelectionEmpty()) { | |
throw new AssertionError("Selection should be empty"); | |
} | |
if (defaultListSelectionModel.getLeadSelectionIndex() != -1) { | |
throw new AssertionError("Selection is empty => there is no lead selected index => " + | |
"lead selected index must be -1 but lead selected index = " + | |
defaultListSelectionModel.getLeadSelectionIndex()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment