From 8e2023f3b7c46fac1c4c6b10058bfb146355cc85 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 13 Sep 2023 20:33:20 +0100 Subject: [PATCH] JAL-4274 comments to help follow the tests --- test/jalview/util/ImageMakerTest.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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"); -- 1.7.10.2