public void run(UiContext context) throws Exception {
context.useShell("Color chooser");
{
List<ColorsGridComposite> grids = context.findWidgets(ColorsGridComposite.class);
ColorsGridComposite colorsComposite = grids.get(1);
EventSender sender = new EventSender(colorsComposite);
sender.moveTo(30, 50).click();
}
context.clickButton("OK");
}
});
assertEquals(getSource(".style {", " color: cornflowerblue;", "}"), getFileContent(styleFile));
// animate Text widget
{
PropertyTable propertyTable = new PropertyTable(TEST_COMBO_SHELL, SWT.NONE);
try {
PropertyEditor propertyEditor = property.getEditor();
propertyTable.setInput(new Property[]{property});
propertyTable.setActiveProperty(property);
// press "b", activate editor
new EventSender(propertyTable).keyDown(0, 'b');
// set text and press Enter
{
CComboBox combo = (CComboBox) ReflectionUtils.getFieldObject(propertyEditor, "m_combo");
Text comboText = (Text) ReflectionUtils.getFieldObject(combo, "m_text");
// drop-down in async
waitEventLoop(0);
assertTrue(combo.isDroppedDown());
// animate
EventSender eventSender = new EventSender(comboText);
eventSender.keyDown(SWT.ESC);
combo.setSelectionText("green");
eventSender.keyDown(SWT.CR);
}
} finally {
propertyTable.dispose();
}
assertEquals(getSource(".style {", " color: green;", "}"), getFileContent(styleFile));