/** * Test addAction. */ @Test public void testAddAction() { WTable table = new WTable(); WButton button = new WButton(); table.addAction(button); table.setLocked(true); setActiveContext(createUIContext()); List<WButton> actions = table.getActions(); Assert.assertEquals("should get action added", button, actions.get(0)); Assert.assertEquals("should be 1 item in list", 1, table.getActions().size()); Assert.assertEquals("should get action added in list", button, table.getActions().get(0)); // Add action to user context WButton button2 = new WButton(); table.addAction(button2); Assert.assertEquals("should be 2 items in list with uic", 2, table.getActions().size()); Assert.assertEquals("should get action added in list with uic", button, table.getActions(). get(0)); Assert.assertEquals("should get second action added in list with uic", button2, table. getActions().get(1)); // Default context should be unaffected. resetContext(); Assert.assertEquals("should be 1 item in list", 1, table.getActions().size()); Assert.assertEquals("should get action added in list", button, table.getActions().get(0)); }
List<WButton> tableActions = table.getActions();