Search in sources :

Example 1 with DynamicStringField

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);
    }
}
Also used : DynamicStringField(org.eclipse.scout.testing.client.form.DynamicStringField) IForm(org.eclipse.scout.rt.client.ui.form.IForm) Test(org.junit.Test)

Example 2 with DynamicStringField

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();
    }
}
Also used : DynamicOkButton(org.eclipse.scout.testing.client.form.DynamicOkButton) ArrayList(java.util.ArrayList) IRunnable(org.eclipse.scout.rt.platform.util.concurrent.IRunnable) DynamicStringField(org.eclipse.scout.testing.client.form.DynamicStringField) FormHandler(org.eclipse.scout.testing.client.form.FormHandler) DynamicCancelButton(org.eclipse.scout.testing.client.form.DynamicCancelButton) DynamicForm(org.eclipse.scout.testing.client.form.DynamicForm) DynamicGroupBox(org.eclipse.scout.testing.client.form.DynamicGroupBox)

Example 3 with DynamicStringField

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());
}
Also used : DynamicOkButton(org.eclipse.scout.testing.client.form.DynamicOkButton) ArrayList(java.util.ArrayList) IRunnable(org.eclipse.scout.rt.platform.util.concurrent.IRunnable) DynamicStringField(org.eclipse.scout.testing.client.form.DynamicStringField) FormHandler(org.eclipse.scout.testing.client.form.FormHandler) DynamicCancelButton(org.eclipse.scout.testing.client.form.DynamicCancelButton) DynamicForm(org.eclipse.scout.testing.client.form.DynamicForm) DynamicGroupBox(org.eclipse.scout.testing.client.form.DynamicGroupBox)

Example 4 with DynamicStringField

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));
}
Also used : DynamicStringField(org.eclipse.scout.testing.client.form.DynamicStringField) Test(org.junit.Test)

Aggregations

DynamicStringField (org.eclipse.scout.testing.client.form.DynamicStringField)4 ArrayList (java.util.ArrayList)2 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)2 DynamicCancelButton (org.eclipse.scout.testing.client.form.DynamicCancelButton)2 DynamicForm (org.eclipse.scout.testing.client.form.DynamicForm)2 DynamicGroupBox (org.eclipse.scout.testing.client.form.DynamicGroupBox)2 DynamicOkButton (org.eclipse.scout.testing.client.form.DynamicOkButton)2 FormHandler (org.eclipse.scout.testing.client.form.FormHandler)2 Test (org.junit.Test)2 IForm (org.eclipse.scout.rt.client.ui.form.IForm)1