use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.
the class AbstractDesktopTest method testDataChangedSimple.
@Test
public void testDataChangedSimple() {
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.dataChanged(TEST_DATA_TYPE_1, TEST_DATA_TYPE_2);
verifyDataChanged(resultHolder);
}
use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.
the class AbstractDesktopTest method testGeolocationFailure.
@Test(expected = ProcessingException.class)
public void testGeolocationFailure() throws Throwable {
TestEnvironmentDesktop desktop = (TestEnvironmentDesktop) IDesktop.CURRENT.get();
Future<Coordinates> coordinatesFurure = desktop.requestGeolocation();
desktop.getUIFacade().fireGeolocationFailed("-1", "test failure");
try {
coordinatesFurure.get();
} catch (ExecutionException e) {
throw e.getCause();
}
}
use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.
the class AbstractDesktopTest method testClosingDoBeforeClosingInternal.
/**
* {@link AbstractDesktop#doBeforeClosingInternal()}
*/
@Test
// ensures that this test runs with its own clean desktop
@RunWithClientSession(value = TestEnvironmentClientSession.class, provider = ClientSessionProvider.class)
public void testClosingDoBeforeClosingInternal() {
TestEnvironmentDesktop desktop = (TestEnvironmentDesktop) IDesktop.CURRENT.get();
boolean closing = desktop.doBeforeClosingInternal();
assertTrue(closing);
}
use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.
the class AbstractDesktopTest method testGeolocation.
@Test
public void testGeolocation() throws InterruptedException, ExecutionException {
TestEnvironmentDesktop desktop = (TestEnvironmentDesktop) IDesktop.CURRENT.get();
Future<Coordinates> coordinatesFurure = desktop.requestGeolocation();
desktop.getUIFacade().fireGeolocationDetermined("1.0", "2.0");
Coordinates coordinates = coordinatesFurure.get();
assertEquals("1.0", coordinates.getLatitude());
assertEquals("2.0", coordinates.getLongitude());
}
use of org.eclipse.scout.rt.client.testenvironment.ui.desktop.TestEnvironmentDesktop in project scout.rt by eclipse.
the class AbstractDesktopTest method testDeepLinkHandling.
@Test
public void testDeepLinkHandling() throws Throwable {
IBean<P_TestDeepLinks> reg = BEANS.getBeanManager().registerClass(P_TestDeepLinks.class);
try {
// Create a new desktop, because the IDesktop.CURRENT might be in a state where deep links are not handled (e.g. form open)
final TestEnvironmentDesktop desktop = new TestEnvironmentDesktop();
assertFalse(desktop.handleDeepLink(null));
assertTrue(desktop.handleDeepLink("junittest-ok"));
assertDeepLinkException(desktop, "junittest");
assertDeepLinkException(desktop, "junittest-123");
assertDeepLinkException(desktop, "doesnotexist");
assertDeepLinkException(desktop, "doesnotexist-123");
} finally {
BEANS.getBeanManager().unregisterBean(reg);
}
}
Aggregations