Assert.assertEquals(MAP_HEIGHT / 2, matrix.getDy(), DELTA);
}
@Test
public void testTransformationMatrix() {
Matrix matrix = viewPort.getTransformationMatrix(RenderSpace.SCREEN, RenderSpace.SCREEN);
Assert.assertEquals(Matrix.IDENTITY, matrix);
matrix = viewPort.getTransformationMatrix(RenderSpace.WORLD, RenderSpace.WORLD);
Assert.assertEquals(Matrix.IDENTITY, matrix);
matrix = viewPort.getTransformationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
Assert.assertEquals(viewPort.getScale(), matrix.getXx(), DELTA);
Assert.assertEquals(-viewPort.getScale(), matrix.getYy(), DELTA);
Assert.assertEquals(0.0, matrix.getXy(), DELTA);
Assert.assertEquals(0.0, matrix.getYx(), DELTA);
Assert.assertEquals(MAP_WIDTH / 2, matrix.getDx(), DELTA);
Assert.assertEquals(MAP_HEIGHT / 2, matrix.getDy(), DELTA);
// Now move the map:
viewPort.applyScale(viewPort.getScale() * 4);
viewPort.applyPosition(new Coordinate(10, 10));
matrix = viewPort.getTransformationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
Assert.assertEquals(viewPort.getScale(), matrix.getXx(), DELTA);
Assert.assertEquals(-viewPort.getScale(), matrix.getYy(), DELTA);
Assert.assertEquals(0.0, matrix.getXy(), DELTA);
Assert.assertEquals(0.0, matrix.getYx(), DELTA);
Assert.assertEquals((MAP_WIDTH / 2) - (viewPort.getScale() * 10), matrix.getDx(), DELTA);
Assert.assertEquals((MAP_HEIGHT / 2) + (viewPort.getScale() * 10), matrix.getDy(), DELTA);
}