SWTBotTreeItem#select() is not working as it should? [message #805165] |
Thu, 23 February 2012 07:19  |
Eclipse User |
|
|
|
Hi,
I found SWTBotTreeItem#select() to not work as I would expect.
With a tree like this:
+ project
|- file
where the 'project' item is initially collapsed.
This code snippet doesn't select the 'file' item:
tree.expandNode( "project" );
SWTBotTreeItem fileItem = projectItem.select( "file" );
assertEquals( "file", fileItem.getText() );
After it is executed, the projectItem is expanded and selected, hence
the assertion fails with: expected 'file' but was 'project'.
Where as this code succeeds in selecting the 'file' item:
SWTBotTreeItem projectItem = tree.expandNode( "project" );
SWTBotTreeItem fileItem = projectItem.getNode( "file" ).select();
assertEquals( "file", fileItem.getText() );
Is this a bug? Am I missing something?
Thanks in advance,
Rüdiger Herrmann
|
|
|
Re: SWTBotTreeItem#select() is not working as it should? [message #821313 is a reply to message #805165] |
Thu, 15 March 2012 03:31  |
Eclipse User |
|
|
|
Hi,
I donot think this is a bug.
In my opinion,
what【projectItem.select( "file" );】selects is a TreeItem with the name "file", but the node "file" itself isn't selected.
so, you should make the node is selected first, then use tree.select(...) to select the node(s), and return as TreeItem.
hope this can help you.
|
|
|
Powered by
FUDForum. Page generated in 0.04604 seconds