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
11 @Test(groups = { "Functional" })
12 public void testCacheSettingsRecovery()
14 Cache.setPropsAreReadOnly(true);
15 Cache.loadProperties("test/jalview/bin/testProps.jvprops");
17 Cache.removeProperty(BitmapImageSizing.BITMAP_HEIGHT);
18 Cache.removeProperty(BitmapImageSizing.BITMAP_SCALE);
19 Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
21 BitmapImageSizing def = BitmapImageSizing.defaultBitmapImageSizing();
22 BitmapImageSizing zero = BitmapImageSizing.nullBitmapImageSizing();
24 assertEquals(def.height(), zero.height());
25 assertEquals(def.width(), zero.width());
26 assertEquals(def.scale(), zero.scale());
28 Cache.setProperty(BitmapImageSizing.BITMAP_HEIGHT, "120");
29 Cache.setProperty(BitmapImageSizing.BITMAP_SCALE, "24");
30 Cache.setProperty(BitmapImageSizing.BITMAP_WIDTH, "360");
32 // default now updates dynamically
33 // def = BitmapImageSizing.defaultBitmapImageSizing();
35 assertEquals(def.height(), 120);
36 assertEquals(def.width(), 360);
37 assertEquals(def.scale(), 24f);
39 Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
41 // def = BitmapImageSizing.defaultBitmapImageSizing();
42 assertEquals(def.height(), 120);
43 assertEquals(def.width(), zero.width());
44 assertEquals(def.scale(), 24f);