@Test(expected = IllegalArgumentException.class) public void testConstructor_CopyWithNull() throws Exception { ShapeAttributes attributes = new ShapeAttributes(null); fail("Expected an IllegalArgumentException to be thrown."); }
@Test public void testSetOutlineWidth() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); float width = 2.5f; attributes.setOutlineWidth(width); assertEquals(width, attributes.outlineWidth, 1e-15); }
@Test public void testSetDrawInterior() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); attributes.drawInterior = true; attributes.setDrawInterior(false); assertFalse(attributes.drawInterior); }
@Test public void testSetEnableLighting() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); attributes.enableLighting = true; attributes.setEnableLighting(false); assertFalse(attributes.enableLighting); }
@Test public void testSetOutlineImageSource() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); ImageSource imageSource = ImageSource.fromObject(new Object()); attributes.setOutlineImageSource(imageSource); assertEquals(imageSource, attributes.outlineImageSource); } }
@Test(expected = IllegalArgumentException.class) public void testSet_WithNull() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); attributes.set(null); fail("Expected an IllegalArgumentException to be thrown."); }
@Test public void testSetDrawOutline() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); attributes.drawOutline = true; attributes.setDrawOutline(false); assertFalse(attributes.drawOutline); }
@Test public void testSetDrawVerticals() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); attributes.drawVerticals = true; attributes.setDrawVerticals(false); assertFalse(attributes.drawVerticals); }
@Test public void testGetOutlineWidth() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); float width = 2.5f; attributes.outlineWidth = width; assertEquals(width, attributes.getOutlineWidth(), 1e-15); }
@Test public void testSetDepthTest() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); attributes.depthTest = true; attributes.setDepthTest(false); assertFalse(attributes.depthTest); }
@Test public void testGetInteriorImageSource() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); ImageSource imageSource = ImageSource.fromObject(new Object()); attributes.interiorImageSource = imageSource; assertEquals(imageSource, attributes.getInteriorImageSource()); }
@Test public void testSetAttributes() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); AbstractShape shape = new AbstractShapeImpl(); shape.setAttributes(attributes); assertTrue(attributes == shape.attributes); }
@Test public void testGetOutlineColor() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); Color black = new Color(0, 0, 0, 1); attributes.outlineColor = black; assertEquals(black, attributes.getOutlineColor()); }
@Test public void testGetInteriorColor() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); Color black = new Color(0, 0, 0, 1); attributes.interiorColor = black; assertEquals(black, attributes.getInteriorColor()); }
@Test public void testGetAttributes() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); AbstractShape shape = new AbstractShapeImpl(attributes); ShapeAttributes result = shape.getAttributes(); assertTrue(attributes == result); }
@Test public void testSetHighlightAttributes() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); AbstractShape shape = new AbstractShapeImpl(); shape.setHighlightAttributes(attributes); assertTrue(attributes == shape.highlightAttributes); }
@Test public void testIsDrawInterior() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); // Assert the getter is returning the changed member attributes.drawInterior = true; assertTrue(attributes.isDrawInterior()); attributes.drawInterior = false; assertFalse(attributes.isDrawInterior()); }
@Test public void testIsDepthTest() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); // Assert the getter is returning the changed member attributes.depthTest = true; assertTrue(attributes.isDepthTest()); attributes.depthTest = false; assertFalse(attributes.isDepthTest()); }
@Test public void testIsEnableLighting() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); // Assert the getter is returning the changed member attributes.enableLighting = true; assertTrue(attributes.isEnableLighting()); attributes.enableLighting = false; assertFalse(attributes.isEnableLighting()); }
@Test public void testSetInteriorColor() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); Color black = new Color(0, 0, 0, 1); attributes.setInteriorColor(black); // Verify that the object is an equivalent deep copy. assertEquals(black, attributes.interiorColor); assertTrue(black != attributes.interiorColor); }