Triggering a mouse hover event on a toolbar item

149 views Asked by At

I have an RCP app for which I am using SWTBot to implement UI tests. I have a particular use case that I can't seem to be able to generate tests for.

I have a view that contains several items in its toolbar. One of them reacts to a mouse hover event only and I haven't found a way yet to trigger a mouse hover event in SWTBot for this particular toolbar item.

Any ideas how to do that ? Here is my attempt so far that results in the below exception:

final IToolBarManager items = mySwtBotView.getViewReference().getView(false).getViewSite().getActionBars().getToolBarManager();
      for (final IContributionItem item : items.getItems()) {

            final Widget widget = (Widget) item;
            widget.notifyListeners(SWT.MouseHover, null);
      }

java.lang.ClassCastException: class MyToolbarAction cannot be cast to class org.eclipse.swt.widgets.Widget (class MyToolbarAction is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @68aa43bb;

Thanks in advance

0

There are 0 answers