1 package jalview.util.imagemaker;
3 import static org.testng.Assert.assertEquals;
5 import org.testng.annotations.Test;
7 import jalview.bin.Cache;
9 public class BitmapImageSizeTest {
10 @Test(groups = {"Functional"})
11 public void testCacheSettingsRecovery() {
12 Cache.setPropsAreReadOnly(true);
13 Cache.loadProperties("test/jalview/bin/testProps.jvprops");
15 Cache.removeProperty(BitmapImageSizing.BITMAP_HEIGHT);
16 Cache.removeProperty(BitmapImageSizing.BITMAP_SCALE);
17 Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
19 BitmapImageSizing def = BitmapImageSizing.defaultBitmapImageSizing();
20 BitmapImageSizing zero = BitmapImageSizing.nullBitmapImageSizing();
22 assertEquals(def.height, zero.height);
23 assertEquals(def.width, zero.width);
24 assertEquals(def.scale, zero.scale);
26 Cache.setProperty(BitmapImageSizing.BITMAP_HEIGHT,"120");
27 Cache.setProperty(BitmapImageSizing.BITMAP_SCALE,"240");
28 Cache.setProperty(BitmapImageSizing.BITMAP_WIDTH,"360");
30 def = BitmapImageSizing.defaultBitmapImageSizing();
32 assertEquals(def.height, 120);
33 assertEquals(def.width, 360);
34 assertEquals(def.scale, 24f);
36 Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
38 def = BitmapImageSizing.defaultBitmapImageSizing();
39 assertEquals(def.height, 120);
40 assertEquals(def.width, zero.width);
41 assertEquals(def.scale, 24f);