X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=getdown%2Fsrc%2Fgetdown%2Fcore%2Fsrc%2Ftest%2Fjava%2Fcom%2Fthreerings%2Fgetdown%2Futil%2FColorTest.java;fp=getdown%2Fsrc%2Fgetdown%2Fcore%2Fsrc%2Ftest%2Fjava%2Fcom%2Fthreerings%2Fgetdown%2Futil%2FColorTest.java;h=7aa48eef45ca753f3921cdf0c46a604050fd9664;hb=ca8504cf9d10874dce9f07cf7a9d933853fe0dd0;hp=0000000000000000000000000000000000000000;hpb=775e7bc104584e88dddcea73fbf02c66f5200c16;p=jalview.git diff --git a/getdown/src/getdown/core/src/test/java/com/threerings/getdown/util/ColorTest.java b/getdown/src/getdown/core/src/test/java/com/threerings/getdown/util/ColorTest.java new file mode 100644 index 0000000..7aa48ee --- /dev/null +++ b/getdown/src/getdown/core/src/test/java/com/threerings/getdown/util/ColorTest.java @@ -0,0 +1,23 @@ +// +// Getdown - application installer, patcher and launcher +// Copyright (C) 2004-2018 Getdown authors +// https://github.com/threerings/getdown/blob/master/LICENSE + +package com.threerings.getdown.util; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +/** + * Tests {@link Color}. + */ +public class ColorTest +{ + @Test + public void testBrightness() { + assertEquals(0, Color.brightness(0xFF000000), 0.0000001); + assertEquals(1, Color.brightness(0xFFFFFFFF), 0.0000001); + assertEquals(0.0117647, Color.brightness(0xFF010203), 0.0000001); + assertEquals(1, Color.brightness(0xFF00FFC8), 0.0000001); + } +}