public void testApplyBounds() {
Assert.assertEquals(4.0, viewPort.getScale());
Assert.assertNull(event);
GeometryFactory factory = new GeometryFactoryImpl();
HandlerRegistration reg = eventBus.addHandler(ViewPortChangedHandler.TYPE, new AllowChangedHandler());
// Now a changed event should occur:
viewPort.applyBounds(factory.createBbox(0, 0, 100, 100));
Assert.assertEquals(8.0, viewPort.getScale());
Assert.assertNotNull(event);
Assert.assertTrue(event instanceof ViewPortChangedEvent);
reg.removeHandler();
reg = eventBus.addHandler(ViewPortChangedHandler.TYPE, new AllowTranslationHandler());
// Expect to end up at the same scale, so no changed event, but translation only:
viewPort.applyBounds(factory.createBbox(-50, -50, 100, 100));
Assert.assertEquals(8.0, viewPort.getScale());
Assert.assertNotNull(event);
Assert.assertTrue(event instanceof ViewPortTranslatedEvent);
reg.removeHandler();
}