+ assertNull(UserColourScheme.getColourFromString("100,200,300"));
+ assertNull(UserColourScheme.getColourFromString("100,200"));
+ assertNull(UserColourScheme.getColourFromString("100,200,100,200"));
+ }
+
+ @Test(groups = "Functional")
+ public void testParseAppletParameter()
+ {
+ UserColourScheme cs = new UserColourScheme("white");
+ cs.parseAppletParameter("D,E=red; K,R,H=0022FF; c=10 , 20,30");
+ assertEquals(Color.RED, cs.findColour('D'));
+ assertEquals(Color.RED, cs.findColour('d'));
+ assertEquals(Color.RED, cs.findColour('E'));
+ assertEquals(Color.RED, cs.findColour('e'));
+ Color c1 = new Color(0x0022ff);
+ assertEquals(c1, cs.findColour('K'));
+ assertEquals(c1, cs.findColour('R'));
+ assertEquals(c1, cs.findColour('h'));
+ Color c2 = new Color(10, 20, 30);
+ assertEquals(c2, cs.findColour('c'));
+
+ cs = new UserColourScheme("white");
+ cs.parseAppletParameter("D,E=red; K,R,H=0022FF; c=10 , 20,30;lowercase=blue;s=pink");
+ assertEquals(Color.RED, cs.findColour('D'));
+ assertEquals(Color.blue, cs.findColour('d'));
+ assertEquals(Color.RED, cs.findColour('E'));
+ assertEquals(Color.blue, cs.findColour('e'));
+ assertEquals(c1, cs.findColour('K'));
+ assertEquals(c1, cs.findColour('R'));
+ assertEquals(Color.blue, cs.findColour('h'));
+ assertEquals(c2, cs.findColour('c'));
+ // 'lowercase' sets all lower-case not already set to the given colour
+ assertEquals(Color.blue, cs.findColour('k'));
+ assertEquals(Color.blue, cs.findColour('a'));
+ assertEquals(Color.pink, cs.findColour('s'));