Search in sources :

Example 6 with TestEnvironmentDesktop

use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.

the class TestEnvironmentClientSession method execLoadSession.

@Override
protected void execLoadSession() {
    // do not enable client notifications, do not add service tunnel
    final TestEnvironmentDesktop d = new TestEnvironmentDesktop();
    setDesktop(d);
    simulateDesktopOpened(d);
}
Also used : TestEnvironmentDesktop(org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop)

Example 7 with TestEnvironmentDesktop

use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.

the class AbstractDesktopTest method testDataChangedChanging.

@Test
public void testDataChangedChanging() {
    TestEnvironmentDesktop desktop = (TestEnvironmentDesktop) IDesktop.CURRENT.get();
    final Holder<Object[]> resultHolder = new Holder<Object[]>(Object[].class);
    desktop.addDataChangeListener(new DataChangeListener() {

        @Override
        public void dataChanged(Object... dataTypes) {
            resultHolder.setValue(dataTypes);
        }
    }, TEST_DATA_TYPE_1, TEST_DATA_TYPE_2);
    desktop.setDataChanging(true);
    desktop.dataChanged(TEST_DATA_TYPE_1);
    desktop.dataChanged(TEST_DATA_TYPE_1, TEST_DATA_TYPE_1, TEST_DATA_TYPE_1);
    desktop.dataChanged(TEST_DATA_TYPE_2, TEST_DATA_TYPE_2);
    desktop.dataChanged(TEST_DATA_TYPE_1, TEST_DATA_TYPE_2);
    desktop.dataChanged(TEST_DATA_TYPE_1);
    desktop.dataChanged(TEST_DATA_TYPE_2);
    desktop.setDataChanging(false);
    verifyDataChanged(resultHolder);
}
Also used : Holder(org.eclipse.scout.rt.platform.holders.Holder) DataChangeListener(org.eclipse.scout.rt.client.ui.DataChangeListener) TestEnvironmentDesktop(org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop) Test(org.junit.Test)

Example 8 with TestEnvironmentDesktop

use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.

the class AbstractDesktopTest method testGetDialogs.

@Test
public void testGetDialogs() {
    TestEnvironmentDesktop desktop = (TestEnvironmentDesktop) IDesktop.CURRENT.get();
    // form
    // _________________|___________________________
    // |                 |                          |
    // form_1            form_2                     form_3
    // _______|________________          |
    // |           |            |      form_3_1
    // form_2_1    form_2_2    form_2_3
    // __________|_____                   |
    // |               |              form_2_3_1
    // form_2_1_1        form_2_1_2
    // |
    // form_2_1_2_1
    P_Form form = new P_Form("form");
    form.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form.setDisplayParent(desktop);
    form.start();
    P_Form form_1 = new P_Form("form_1");
    form_1.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_1.setDisplayParent(form);
    form_1.start();
    P_Form form_2 = new P_Form("form_2");
    form_2.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2.setDisplayParent(form);
    form_2.start();
    P_Form form_3 = new P_Form("form_3");
    form_3.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_3.setDisplayParent(form);
    form_3.start();
    P_Form form_2_1 = new P_Form("form_2_1");
    form_2_1.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2_1.setDisplayParent(form_2);
    form_2_1.start();
    P_Form form_2_2 = new P_Form("form_2_2");
    form_2_2.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2_2.setDisplayParent(form_2);
    form_2_2.start();
    P_Form form_2_3 = new P_Form("form_2_3");
    form_2_3.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2_3.setDisplayParent(form_2);
    form_2_3.start();
    P_Form form_2_3_1 = new P_Form("form_2_3_1");
    form_2_3_1.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2_3_1.setDisplayParent(form_2_3);
    form_2_3_1.start();
    P_Form form_3_1 = new P_Form("form_3_1");
    form_3_1.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_3_1.setDisplayParent(form_3);
    form_3_1.start();
    P_Form form_2_1_1 = new P_Form("form_2_1_1");
    form_2_1_1.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2_1_1.setDisplayParent(form_2_1);
    form_2_1_1.start();
    P_Form form_2_1_2 = new P_Form("form_2_1_2");
    form_2_1_2.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2_1_2.setDisplayParent(form_2_1);
    form_2_1_2.start();
    P_Form form_2_1_2_1 = new P_Form("form_2_1_2_1");
    form_2_1_2_1.setDisplayHint(IForm.DISPLAY_HINT_DIALOG);
    form_2_1_2_1.setDisplayParent(form_2_1_2);
    form_2_1_2_1.start();
    assertEquals(CollectionUtility.arrayList(form_1, form_2, form_3), desktop.getDialogs(form, false));
    assertEquals(CollectionUtility.arrayList(form_1, form_2_1_1, form_2_1_2_1, form_2_1_2, form_2_1, form_2_2, form_2_3_1, form_2_3, form_2, form_3_1, form_3), desktop.getDialogs(form, true));
}
Also used : TestEnvironmentDesktop(org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop) Test(org.junit.Test)

Example 9 with TestEnvironmentDesktop

use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.

the class AbstractDesktopTest method testUnsavedForms.

@Test
public void testUnsavedForms() {
    TestEnvironmentDesktop desktop = (TestEnvironmentDesktop) IDesktop.CURRENT.get();
    P_CheckSaveTestForm testForm = new P_CheckSaveTestForm();
    try {
        testForm.startNew();
        testForm.getMessageField().setValue("test");
        assertTrue(desktop.getUnsavedForms().contains(testForm));
    } finally {
        testForm.doClose();
    }
}
Also used : TestEnvironmentDesktop(org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop) Test(org.junit.Test)

Aggregations

TestEnvironmentDesktop (org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop)9 Test (org.junit.Test)8 Coordinates (org.eclipse.scout.rt.client.ui.Coordinates)2 DataChangeListener (org.eclipse.scout.rt.client.ui.DataChangeListener)2 Holder (org.eclipse.scout.rt.platform.holders.Holder)2 ExecutionException (java.util.concurrent.ExecutionException)1 RunWithClientSession (org.eclipse.scout.rt.testing.client.runner.RunWithClientSession)1