use of org.eclipse.scout.testing.client.form.DynamicStringField in project scout.rt by eclipse.
the class ListBoxTest method testGetForm.
@Test
public void testGetForm() {
IForm formMock = mock(IForm.class);
DynamicStringField stringField = new DynamicStringField("id", "test");
addField(stringField);
try {
setFormInternal(formMock);
assertEquals(formMock, getForm());
assertEquals(formMock, getListBoxFilterBox().getForm());
assertEquals(formMock, stringField.getForm());
} finally {
removeField(stringField);
}
}
use of org.eclipse.scout.testing.client.form.DynamicStringField in project scout.rt by eclipse.
the class FormBasicTest method testStartAndWaitImpl.
protected void testStartAndWaitImpl(final boolean modal, final int displayHint, final String viewId) throws Exception {
final ArrayList<Integer> testSequence = new ArrayList<Integer>();
DynamicGroupBox mainBox = new DynamicGroupBox(new DynamicStringField("f1", "First Name"), new DynamicStringField("f2", "Last Name"), new DynamicStringField("f3", "Address"), new DynamicOkButton(), new DynamicCancelButton());
final DynamicForm f = new DynamicForm("Form1", mainBox);
f.setModal(modal);
f.setDisplayHint(displayHint);
f.setDisplayViewId(viewId);
testSequence.add(0);
testSequence.add(1);
// emulate that gui clicks on ok button
IFuture<Void> future = ModelJobs.schedule(new IRunnable() {
@Override
public void run() throws Exception {
testSequence.add(2);
f.getButton("ok").getUIFacade().fireButtonClickFromUI();
Thread.sleep(200L);
testSequence.add(3);
}
}, ModelJobs.newInput(ClientRunContexts.copyCurrent()).withExecutionTrigger(Jobs.newExecutionTrigger().withStartIn(200, TimeUnit.MILLISECONDS)));
try {
f.start(new FormHandler());
f.waitFor();
testSequence.add(4);
future.awaitDoneAndGet();
ScoutAssert.assertOrder(new Integer[] { 0, 1, 2, 3, 4 }, testSequence.toArray());
} finally {
f.doClose();
}
}
use of org.eclipse.scout.testing.client.form.DynamicStringField in project scout.rt by eclipse.
the class FormWaitForTest method testStartAndWaitImpl.
protected void testStartAndWaitImpl(final boolean modal, final int displayHint, final String viewId) throws Exception {
final ArrayList<Integer> testSequence = new ArrayList<Integer>();
DynamicGroupBox mainBox = new DynamicGroupBox(new DynamicStringField("f1", "First Name"), new DynamicOkButton(), new DynamicCancelButton());
final DynamicForm form = new DynamicForm("Form1", mainBox);
form.setModal(modal);
form.setDisplayHint(displayHint);
form.setDisplayViewId(viewId);
testSequence.add(0);
IFuture<Void> future = ModelJobs.schedule(new IRunnable() {
@Override
public void run() throws Exception {
testSequence.add(3);
form.doClose();
testSequence.add(4);
LOG.debug("ClientSyncWaitForTest.testStartAndWaitImpl(...).new ClientSyncJob() {...}.runVoid() finished");
}
}, ModelJobs.newInput(ClientRunContexts.copyCurrent()));
LOG.debug("ClientSessionProvider.currentSession()");
LOG.debug("ClientSessionProvider.currentSession().getDesktop()");
testSequence.add(1);
form.start(new FormHandler());
testSequence.add(2);
LOG.debug("ClientSyncWaitForTest.testStartAndWaitImpl() before waitFor");
form.waitFor();
LOG.debug("ClientSyncWaitForTest.testStartAndWaitImpl() after waitFor");
testSequence.add(5);
future.awaitDoneAndGet();
ScoutAssert.assertOrder(new Integer[] { 0, 1, 2, 3, 4, 5 }, testSequence.toArray());
}
use of org.eclipse.scout.testing.client.form.DynamicStringField in project scout.rt by eclipse.
the class AbstractRadioButtonGroupTest method testAddField.
@Test
public void testAddField() {
DynamicStringField field = new DynamicStringField("id", "test-field");
assertNull(getFieldPropertyChangeListener(field));
m_group.addField(field);
assertNotNull(getFieldPropertyChangeListener(field));
}
Aggregations