context.clickButton("Default");
}
private int getSpinnerValue(UiContext context, String text) {
Control control = context.getControlAfterLabel(text);
CSpinner spinner = (CSpinner) control;
return spinner.getSelection();
}
});
assertEditor(
"public class Test extends LayoutContainer {",
" public Test() {",
" FlowLayout flowLayout = new FlowLayout();",
" setLayout(flowLayout);",
" }",
"}");
assertFalse(property.isModified());
assertEquals(null, getPropertyText(property));
// set value using editor
new UiContext().executeAndCheck(new UIRunnable() {
public void run(UiContext context) throws Exception {
openPropertyDialog(property);
}
}, new UIRunnable() {
public void run(UiContext context) throws Exception {
context.useShell("margins");
// check existing values
setSpinnerValue(context, "Top:", 10);
setSpinnerValue(context, "Right:", 20);
setSpinnerValue(context, "Bottom:", 30);
setSpinnerValue(context, "Left:", 40);
// reset to default
context.clickButton("OK");
}
private void setSpinnerValue(UiContext context, String text, int value) {
CSpinner spinner = getSpinner(context, text);
spinner.setSelection(value);
spinner.notifyListeners(SWT.Selection, null);
}
private CSpinner getSpinner(UiContext context, String text) {
return (CSpinner) context.getControlAfterLabel(text);
}