X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2FImageMakerTest.java;h=d953f7bd38de62a29717291d1991c68fb0fb1da8;hb=8e2023f3b7c46fac1c4c6b10058bfb146355cc85;hp=acb41608c0ef68452101945ec2c0c0ecfc4c6cd3;hpb=1f1d99b50321fbf7d3f1bb5cce55d31bf7c86859;p=jalview.git diff --git a/test/jalview/util/ImageMakerTest.java b/test/jalview/util/ImageMakerTest.java index acb4160..d953f7b 100644 --- a/test/jalview/util/ImageMakerTest.java +++ b/test/jalview/util/ImageMakerTest.java @@ -20,6 +20,7 @@ public class ImageMakerTest BitmapImageSizing bis = null; + // No defaults set, 3 values given. Should be the 3 values. bis = ImageMaker.parseScaleWidthHeightStrings("1.2", "3", "4"); Assert.assertEquals(bis.scale(), 1.2f, "scale not parsed and set to value given"); @@ -28,19 +29,23 @@ public class ImageMakerTest Assert.assertEquals(bis.height(), 4, "height not parsed and set to value given"); + // No defaults set, 1 value given. Should be the 1 value and 2 0s. bis = ImageMaker.parseScaleWidthHeightStrings("1.2", null, null); Assert.assertEquals(bis.scale(), 1.2f, "scale not parsed and set to value given"); Assert.assertEquals(bis.width(), 0, "width not parsed and set to 0"); Assert.assertEquals(bis.height(), 0, "height not parsed and set to 0"); + // No defaults set, 1 value given. Should be the 1 value and 2 0s. (checking + // the other value) bis = ImageMaker.parseScaleWidthHeightStrings(null, "1", null); Assert.assertEquals(bis.scale(), 0f, "scale not parsed and set to 0f"); Assert.assertEquals(bis.width(), 1, "width not parsed and set to value given"); Assert.assertEquals(bis.height(), 0, "height not parsed and set to 0"); - // this should set bis to the dynamic defaultBitmapImageSizing + // No defaults set, no values given, these should first look at defaults and + // then set all to 0 bis = ImageMaker.parseScaleWidthHeightStrings(null, null, null); Assert.assertEquals(bis.scale(), 0f, "scale not parsed and set to undefined default 0f"); @@ -50,6 +55,7 @@ public class ImageMakerTest "height not parsed and set to undefined default 0"); Cache.setProperty(BitmapImageSizing.BITMAP_HEIGHT, "1"); + // 1 default set, bis should detect this Assert.assertEquals(bis.scale(), 0f, "scale not parsed and set to undefined default 0f"); Assert.assertEquals(bis.width(), 0, @@ -59,6 +65,7 @@ public class ImageMakerTest Cache.setProperty(BitmapImageSizing.BITMAP_SCALE, "3.4"); Cache.setProperty(BitmapImageSizing.BITMAP_WIDTH, "2"); + // Now all 3 defaults set, bis should detect this Assert.assertEquals(bis.scale(), 3.4f, "scale not parsed and set to undefined default 3.2f"); Assert.assertEquals(bis.width(), 2, @@ -66,7 +73,7 @@ public class ImageMakerTest Assert.assertEquals(bis.height(), 1, "height not parsed and set to default 1"); - // override actual default values + // 3 defaults set, and 3 values given, should use the 3 values bis = ImageMaker.parseScaleWidthHeightStrings("1.2", "3", "4"); Assert.assertEquals(bis.scale(), 1.2f, "scale not parsed and set to value given"); @@ -75,6 +82,7 @@ public class ImageMakerTest Assert.assertEquals(bis.height(), 4, "height not parsed and set to value given"); + // 3 defaults set, and 1 value given, should use the 1 value and 2 0s bis = ImageMaker.parseScaleWidthHeightStrings("1.2", null, null); Assert.assertEquals(bis.scale(), 1.2f, "scale not parsed and set to value given"); @@ -83,6 +91,7 @@ public class ImageMakerTest Assert.assertEquals(bis.height(), 0, "height not parsed and set to undefined 0"); + // 3 defaults set, and 1 value given, should use the 1 value and 2 0s bis = ImageMaker.parseScaleWidthHeightStrings(null, null, "5"); Assert.assertEquals(bis.scale(), 0f, "scale not parsed and set to undefined 0f"); @@ -91,6 +100,7 @@ public class ImageMakerTest Assert.assertEquals(bis.height(), 5, "height not parsed and set to value given"); + // 3 defaults set, and no values given, should use the 3 default values bis = ImageMaker.parseScaleWidthHeightStrings(null, null, null); Assert.assertEquals(bis.scale(), 3.4f, "scale not parsed and set to undefined default 3.2f");