- public void testCopyConstructor_minMax()
- {
- /*
- * graduated colour
- */
- FeatureColour fc = new FeatureColour(Color.BLUE, Color.RED, 1f, 5f);
- assertTrue(fc.isGraduatedColour());
- assertFalse(fc.isColourByLabel());
- assertFalse(fc.isColourByAttribute());
- assertNull(fc.getAttributeName());
- assertEquals(1f, fc.getMin());
- assertEquals(5f, fc.getMax());
-
- /*
- * update min-max bounds
- */
- FeatureColour fc1 = new FeatureColour(fc, 2f, 6f);
- assertTrue(fc1.isGraduatedColour());
- assertFalse(fc1.isColourByLabel());
- assertFalse(fc1.isColourByAttribute());
- assertNull(fc1.getAttributeName());
- assertEquals(2f, fc1.getMin());
- assertEquals(6f, fc1.getMax());
- assertFalse((boolean) PA.getValue(fc1, "isHighToLow"));
-
- /*
- * update min-max bounds - high to low
- */
- fc1 = new FeatureColour(fc, 23f, 16f);
- assertTrue(fc1.isGraduatedColour());
- assertFalse(fc1.isColourByLabel());
- assertFalse(fc1.isColourByAttribute());
- assertNull(fc1.getAttributeName());
- assertEquals(23f, fc1.getMin());
- assertEquals(16f, fc1.getMax());
- assertTrue((boolean) PA.getValue(fc1, "isHighToLow"));
-
- /*
- * graduated colour by attribute
- */
- fc1.setAttributeName("AF");
- fc1 = new FeatureColour(fc1, 13f, 36f);
- assertTrue(fc1.isGraduatedColour());
- assertFalse(fc1.isColourByLabel());
- assertTrue(fc1.isColourByAttribute());
- assertArrayEquals(new String[] { "AF" }, fc1.getAttributeName());
- assertEquals(13f, fc1.getMin());
- assertEquals(36f, fc1.getMax());
- assertFalse((boolean) PA.getValue(fc1, "isHighToLow"));
-
- /*
- * colour by label
- */
- fc = new FeatureColour(Color.BLUE, Color.RED, 1f, 5f);
- fc.setColourByLabel(true);
- assertFalse(fc.isGraduatedColour());
- assertTrue(fc.isColourByLabel());
- assertFalse(fc.isColourByAttribute());
- assertNull(fc.getAttributeName());
- assertEquals(1f, fc.getMin());
- assertEquals(5f, fc.getMax());
-
- /*
- * update min-max bounds
- */
- fc1 = new FeatureColour(fc, 2f, 6f);
- assertFalse(fc1.isGraduatedColour());
- assertTrue(fc1.isColourByLabel());
- assertFalse(fc1.isColourByAttribute());
- assertNull(fc1.getAttributeName());
- assertEquals(2f, fc1.getMin());
- assertEquals(6f, fc1.getMax());
-
- /*
- * colour by attribute text
- */
- fc1.setAttributeName("AC");
- fc1 = new FeatureColour(fc1, 13f, 36f);
- assertFalse(fc1.isGraduatedColour());
- assertTrue(fc1.isColourByLabel());
- assertTrue(fc1.isColourByAttribute());
- assertArrayEquals(new String[] { "AC" }, fc1.getAttributeName());
- assertEquals(13f, fc1.getMin());
- assertEquals(36f, fc1.getMax());
- }
-
- @Test(groups = { "Functional" })