@Test public void testSetOutlineImageSource() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); ImageSource imageSource = ImageSource.fromObject(new Object()); attributes.setOutlineImageSource(imageSource); assertEquals(imageSource, attributes.outlineImageSource); } }
@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 testSetInteriorImageSource() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); ImageSource imageSource = ImageSource.fromObject(new Object()); attributes.setInteriorImageSource(imageSource); assertEquals(imageSource, attributes.interiorImageSource); }
@Test public void testGetOutlineImageSource() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); ImageSource imageSource = ImageSource.fromObject(new Object()); attributes.outlineImageSource = imageSource; assertEquals(imageSource, attributes.getOutlineImageSource()); }
@Test public void testSet() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); // create another attribute bundle with differing values ShapeAttributes other = new ShapeAttributes(); other.drawInterior = false; other.drawOutline = false; other.drawVerticals = true; other.depthTest = false; other.enableLighting = true; other.interiorColor = new Color(0, 0, 0, 0); other.outlineColor = new Color(0, 1, 1, 0); other.outlineWidth = 0.0f; other.interiorImageSource = ImageSource.fromObject(new Object()); other.outlineImageSource = ImageSource.fromObject(new Object()); attributes.set(other); assertEquals(attributes, other); }
@Test public void testConstructor_Copy() throws Exception { ShapeAttributes attributes = new ShapeAttributes(); attributes.interiorImageSource = ImageSource.fromObject(new Object()); attributes.outlineImageSource = ImageSource.fromObject(new Object()); ShapeAttributes copy = new ShapeAttributes(attributes); assertNotNull(copy); assertEquals(attributes, copy); // Ensure we made a deep copy of the colors assertTrue(copy.interiorColor != attributes.interiorColor); assertTrue(copy.outlineColor != attributes.outlineColor); // Ensure we copied the image sources by reference assertTrue(copy.interiorImageSource == attributes.interiorImageSource); assertTrue(copy.outlineImageSource == attributes.outlineImageSource); }
@Test public void testInequality() throws Exception { ShapeAttributes typical = new ShapeAttributes(); ShapeAttributes different = new ShapeAttributes(); different.drawInterior = false; different.drawOutline = false; different.drawVerticals = true; different.depthTest = false; different.enableLighting = true; different.interiorColor = new Color(0, 0, 0, 0); different.outlineColor = new Color(0, 1, 1, 0); different.outlineWidth = 0.0f; different.interiorImageSource = ImageSource.fromObject(new Object()); different.outlineImageSource = ImageSource.fromObject(new Object()); assertNotEquals(different.drawInterior, typical.drawInterior); assertNotEquals(different.drawOutline, typical.drawOutline); assertNotEquals(different.drawVerticals, typical.drawVerticals); assertNotEquals(different.depthTest, typical.depthTest); assertNotEquals(different.enableLighting, typical.enableLighting); assertNotEquals(different.interiorColor, typical.interiorColor); assertNotEquals(different.outlineColor, typical.outlineColor); assertNotEquals(different.outlineWidth, typical.outlineWidth, 0.0f); assertNotEquals(different.interiorImageSource, typical.interiorImageSource); assertNotEquals(different.outlineImageSource, typical.outlineImageSource); assertNotEquals(different, typical); assertNotEquals(typical, different); assertNotEquals(typical, null); }