Replacement for deprecated SWTBotView.menus method? [message #1731432] |
Thu, 05 May 2016 04:20  |
Eclipse User |
|
|
|
I'm using swtbot's latest snapshot build in which SWTBotViewMenu have been deprecated. I replaced my old calls to view menu with SWTBotView.viewMenu.
But I am not finding replacement for SWTBotView.menus method which returns a list of all menus.
Please tell me the way to replace it in new recommanded way.
Thanks
|
|
|
Re: Replacement for deprecated SWTBotView.menus method? [message #1731464 is a reply to message #1731432] |
Thu, 05 May 2016 11:38   |
Eclipse User |
|
|
|
The reason the method was deprecated from the view menu (and not available either for other types of menus) is that, especially with recursive and dynamic menus, we could not ensure that the MenuItem widget (owned by the returned instances of SWTBotMenu) has not been disposed. It could cause exceptions if you tried to use a menu item that belongs to a sub-menu that has been hidden while searching through other sub-menus.
If you want to verify that the view menu contains an explicit list of menu items, you could use the following:
swtBotView.viewMenu("Item 1");
swtBotView.viewMenu("Item 2");
This does not validate the order however. If order is important you could use the following instead:
assertEquals("Item 1", swtBotView.viewMenu().menu(widgetOfType(MenuItem.class), true, 0).getText());
assertEquals("Item 2", swtBotView.viewMenu().menu(widgetOfType(MenuItem.class), true, 1).getText());
|
|
|
|
Powered by
FUDForum. Page generated in 0.29073 seconds