public void testGetTransform() {
MapBounds bounds = new BBoxMapBounds(DefaultGeographicCRS.WGS84, -0.5, -0.5, 0.5, 0.5);
Dimension mapSize = new Dimension(100, 100);
// no rotation
MapfishMapContext transformer = new MapfishMapContext(bounds, mapSize, 0, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
assertNull(transformer.getTransform());
// rotate 180 degree
transformer = new MapfishMapContext(bounds, mapSize, 180, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
AffineTransform transform = transformer.getTransform();
assertEquals(100, transform.getTranslateX(), 1e-6);
assertEquals(100, transform.getTranslateY(), 1e-6);
double[] matrix = new double[6];
transform.getMatrix(matrix);
assertArrayEquals(new double[] {-1.0, 0.0, 0.0, -1.0, 100.0, 100.0}, matrix, 1e-6);
// rotate 90 degree
transformer = new MapfishMapContext(bounds, mapSize, 90, Constants.PDF_DPI, Constants.PDF_DPI, null, true);
transform = transformer.getTransform();
assertEquals(100, transform.getTranslateX(), 1e-6);
assertEquals(0, transform.getTranslateY(), 1e-6);
matrix = new double[6];
transform.getMatrix(matrix);