public void testTileFuserResolution() throws Exception {
TileLayer layer = createWMSLayer();
// request fits inside -30.0,15.0,45.0,30
BoundingBox bounds = new BoundingBox(-25.0,17.0,40.0,22);
// One in between
int width = (int) bounds.getWidth() * 10;
int height= (int) bounds.getHeight() * 10;
GridSubset gridSubset = layer.getGridSubset(layer.getGridSubsets().iterator().next());
WMSTileFuser tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
tileFuser.determineSourceResolution();
assertEquals(0.087890625, tileFuser.srcResolution, 0.087890625*0.001);
// Zoomed too far out
height = (int) bounds.getWidth() / 10;
width = (int) bounds.getWidth() / 10;
tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
tileFuser.determineSourceResolution();
assertEquals(0,tileFuser.srcIdx);
// Zoomed too far in
height = (int) bounds.getWidth() * 10000;
width = (int) bounds.getWidth() * 10000;
tileFuser = new WMSTileFuser(layer, gridSubset, bounds, width, height);
tileFuser.determineSourceResolution();
assertEquals(10,tileFuser.srcIdx);
}