-
Notifications
You must be signed in to change notification settings - Fork 0
SWT Layer usage
The Red Deer SWT layer provides an API for directly accessing and manipulating SWT Widgets and Controls based on SWTBot.
The SWT Layer is used by higher level RedDeer plugins. If you're testing Eclipse or RCP applications (for example,org.jboss.tools.eclipse) you should use higher layers API (like Eclipse layer) for you tests. SWTLayer is intended to be used mainly for building higher abstraction levels and to be used in pure SWT applications.
The SWT Layer can be used outside of Red Deer when direct SWT Widget manipulation is needed, making it it suitable for pure SWT application testing.
just add org.jboss.reddeer.swt
into your MANIFEST.MF
// Object lookup
Shell shell = new WorkbenchShell();
// Object state read
assertEquals("Eclipse",shell.getTitle());
// Object lookup
Button button = new PushButton("Ok");
// Object manipulation
button.click();
// Select menuitem of the shell
Menu menu = new ShellMenu("Window","Properties");
menu.select();
Menu instances provides constructors to allow use predefined or users custom matchers and multi-matchers builders (for regex lookup, etc.)
RegexMatchers m = new RegexMatchers("Win.*", "Prefz.*");
Menu menu = new ShellMenu(m.getMatchers());
These are thrown by Reddeer SWT layer
SWTLayerException - exception indicates unexpected state on SWTLayer (widget not found, widget lost, multiple widgets, etc.)
If you want to react to these exception you need to catch them in your code:
try {
Button b = new PushButton("OK");
}
catch (SWTLayerException e) {
doSomething();
}
SWT Layer aims to implement these [https://github.com/jboss-reddeer/reddeer/tree/master/org.jboss.reddeer.swt/src/org/jboss/reddeer/swt/api] (https://github.com/jboss-reddeer/reddeer/tree/master/org.jboss.reddeer.swt/src/org/jboss/reddeer/swt/api)
- Browser.java
- Button.java
- Canvas.java
- CLabel.java
- Combo.java
- Composite.java
- CoolBar.java
- CTabFolder.java
- DateTime.java
- ExpandBar.java
- Group.java
- Label.java
- Link.java
- List.java
- Menu.java
- ProgressBar.java
- Sash.java
- Scale.java
- ScrolledComposite.java
- Shell.java
- Slider.java
- Spinner.java
- StyledText.java
- TabFolder.java
- Table.java
- Text.java
- ToolBar.java
- Tray.java
- TreeItem.java
- Tree.java
JBoss Red Deer - Quick Links
- Home
- Getting Started
- [Release notes] (/jboss-reddeer/reddeer/wiki/Release-notes)
- User section
- Contributor section
- FAQ