@Test public void setsMultipleSelection() throws Exception { bot.radio("SWT.MULTI").click(); tree = bot.treeInGroup("Tree"); tree.select(new String[] {"Node 2", "Node 4"}); assertEquals(2, tree.selectionCount()); TableCollection selection = tree.selection(); assertEquals("Node 2", selection.get(0, 0)); assertEquals("Node 4", selection.get(1, 0)); }
@Test public void getsSingleSelection() throws Exception { bot.checkBox("Multiple Columns").select(); tree = bot.treeInGroup("Tree"); tree.select(2); TableCollection selection = tree.selection(); assertEquals(1, selection.rowCount()); assertEquals(4, selection.columnCount()); assertEquals( new TableCollection() .add(new TableRow(new String[] {"Node 3", "images", "91571", "yesterday"})), selection); }
@Test public void getsMultipleSingleSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Multiple Columns").select(); tree = bot.treeInGroup("Tree"); tree.select(new int[] {1, 2}); TableCollection selection = tree.selection(); assertEquals("Node 2", selection.get(0, 0)); assertEquals("databases", selection.get(0, 1)); assertEquals("2556", selection.get(0, 2)); assertEquals("tomorrow", selection.get(0, 3)); assertEquals( new TableRow(new String[] {"Node 3", "images", "91571", "yesterday"}), selection.get(1)); }
@Test public void getsSelectionCount() throws Exception { assertEquals(0, tree.selection().columnCount()); assertEquals(0, tree.selection().rowCount()); assertEquals(0, tree.selectionCount()); }