After having fun with SWTBotTreeItem.expand() I have observed some behavior I did not expect with the SWTBotTreeItem.select() method. The code included below selects a the General > Project node in "New Project" wizard. The select call also triggers the "Next >" button (as if I selected the button and clicked it). Stepping through this in the debugger seems to show that the button is actually triggered by the "notify(SWT.DefaultSelection)" statement in SWTBodTreeItem#notifySelect().
I am not complaining about it. This actually saves me having to code a
few statement, but I was wondering if this behavior is intentional or
this is something that just happens in my environment...
package test.com.jolira.simulator.workbench;
import junit.framework.TestCase;
import net.sf.swtbot.eclipse.finder.SWTBotEclipseTestCase;
import net.sf.swtbot.eclipse.finder.widgets.SWTBotView;
import net.sf.swtbot.widgets.*;
public class SimulatorTest extends SWTBotEclipseTestCase {
private static final String TEST_PROJECT = "Test Project";
public void testDemo() throws Exception {
final SWTBotMenu fileMenu = bot.menu("File");
final SWTBotMenu newFileMenu = fileMenu.menu("New");
final SWTBotMenu newProjectMenu =
newFileMenu.menu("Project...");
newProjectMenu.click();
final SWTBotTree tree = bot.tree();
tree.setFocus();
final SWTBotTreeItem generalNode = tree.expandNode("General");
generalNode.select("Project"); // Triggers "Next >" button
final SWTBotText projectNameText = bot.text("");
projectNameText.setText(TEST_PROJECT);
final SWTBotButton finishButton = bot.button("Finish");
finishButton.click();
}
}
Joachim F. Kainz
http://jolira.com
<<attachment: jolira.png>>
------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________ SWTBot-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/swtbot-users http://swtbot.org/ - a functional testing tool for SWT/Eclipse
