use of com.b3dgs.lionengine.graphic.ImageHeader in project lionengine by b3dgs.
the class SpriteParallaxedTest method testParallax.
/**
* Test parallax sprite.
*/
@SuppressWarnings("unlikely-arg-type")
@Test
public void testParallax() {
final ImageHeader info = ImageInfo.get(media);
final SpriteParallaxed spriteA = Drawable.loadSpriteParallaxed(media, LINES, 60, 100);
spriteA.load(false);
Assert.assertTrue(spriteA.equals(spriteA));
Assert.assertEquals(info.getHeight() / LINES, spriteA.getHeight());
Assert.assertEquals(38, spriteA.getWidth());
Assert.assertEquals(41, spriteA.getLineWidth(2));
// Test render
spriteA.render(g, 0, 0, 0);
// Resize
final SpriteParallaxed spriteB = Drawable.loadSpriteParallaxed(media, LINES, 60, 100);
spriteB.stretch(200, 100);
spriteB.load(true);
Assert.assertFalse(spriteB.equals(spriteA));
Assert.assertTrue(spriteA.hashCode() != spriteB.hashCode());
Assert.assertFalse(spriteA.equals(media));
final SpriteParallaxed spriteC = Drawable.loadSpriteParallaxed(media, LINES, 60, 100);
spriteC.stretch(100, 200);
spriteC.load(true);
Assert.assertFalse(spriteC.equals(spriteA));
Assert.assertTrue(spriteA.hashCode() != spriteC.hashCode());
Assert.assertFalse(spriteA.equals(media));
}
Aggregations