X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2FFormatTest.java;h=422132aa8615233f1c1fb517ec5e20fc55a5cc89;hb=76f9992a5fd8e818f8051130e25c6aefb4ef51ad;hp=999e45616dbf28049a5dcf40e97c653897b381bc;hpb=05951a61acec617599e9a92828b8a498fab6ae32;p=jalview.git diff --git a/test/jalview/util/FormatTest.java b/test/jalview/util/FormatTest.java index 999e456..422132a 100644 --- a/test/jalview/util/FormatTest.java +++ b/test/jalview/util/FormatTest.java @@ -25,6 +25,8 @@ import static org.testng.Assert.assertTrue; import jalview.gui.JvOptionPane; +import java.awt.Color; + import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -162,4 +164,20 @@ public class FormatTest + "ms"); assertTrue(elapsed2 > elapsed1); } + + @Test(groups = "Functional") + public void testGetHexString() + { + /* + * r = 13 = d base 16, gets padded to 0d + * g = 103 = (16x6) + 7 = 67 base 16 + * b = 219 = (16x13) + 11 = db base 16 + */ + Color c = new Color(13, 103, 219); + assertEquals(Format.getHexString(c), "0d67db"); + + assertEquals(Format.getHexString(Color.black), "000000"); + + assertEquals(Format.getHexString(Color.white), "ffffff"); + } }