@Test
public void testLevels() throws Exception {

	// this test failed before http://jira.geomajas.org/browse/WMS-18
	Crs latlon = geoService.getCrs2(LONLAT);
	Envelope latlonEnvelope = null;
	for (int level = 0; level < 32; level++) {
		double latlonScale = Math.pow(2, level);
		// must reduce envelope as we zoom
		latlonEnvelope = new Envelope(-180, -180 + 1.0 / latlonScale, -412, -412 + 1.0 / latlonScale);
		List<RasterTile> tiles = wms.paint(latlon, latlonEnvelope, latlonScale);
		Assert.assertEquals(1, tiles.size());
		Assert.assertEquals(level, tiles.get(0).getCode().getTileLevel());
		Assert.assertEquals(512, tiles.get(0).getBounds().getHeight(), DELTA);
		Assert.assertEquals(512, tiles.get(0).getBounds().getWidth(), DELTA);
	}
}