Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.schemes

File HelixColourSchemeTest.java

 

Code metrics

0
8
1
1
33
19
1
0.12
8
1
1

Classes

Class Line # Actions
HelixColourSchemeTest 9 8 1 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    package jalview.schemes;
2   
3    import static org.testng.Assert.assertEquals;
4   
5    import java.awt.Color;
6   
7    import org.testng.annotations.Test;
8   
 
9    public class HelixColourSchemeTest
10    {
11    /**
12    * Turn colours are based on the scores in ResidueProperties.helix A = 1.42, R
13    * = 0.98, N = 0.67, D = 1.01... min = 0.57 max = 1.51
14    * <p>
15    * scores are scaled to c 0-1 between min and max and colour is (c, 1-c, c)
16    */
 
17  1 toggle @Test(groups = "Functional")
18    public void testFindColour()
19    {
20  1 ScoreColourScheme scheme = new HelixColourScheme();
21   
22  1 float min = 0.57f;
23  1 float max = 1.51f;
24  1 float a = (1.42f - min) / (max - min);
25  1 assertEquals(scheme.findColour('A', 0, null), new Color(a, 1 - a, a));
26   
27  1 float d = (1.01f - min) / (max - min);
28  1 assertEquals(scheme.findColour('D', 0, null), new Color(d, 1 - d, d));
29   
30  1 assertEquals(scheme.findColour('-', 0, null), Color.WHITE);
31    }
32   
33    }