From 5867e48ff06530ca1e679d5066abda784e014185 Mon Sep 17 00:00:00 2001 From: nwessman Date: Mon, 8 Mar 2021 21:13:55 +0100 Subject: [PATCH] Fix test print json This changes so it is the tests that prints the json not the export function. --- .../graphics/animation/AsepriteHandler.java | 15 ++++----------- .../graphics/animation/AsepriteHandlerTests.java | 6 +++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandler.java b/src/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandler.java index 3857cc966..452b032c9 100644 --- a/src/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandler.java +++ b/src/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandler.java @@ -26,15 +26,15 @@ public ExportAnimationException(String message) { } /** - * Creates the json representation of an animation object and prints it. + * Creates the json representation of an animation object and returns it. * This is the public accesible function and can/should be changed to fit into the UI. * * @param animation the animation object to export */ - public void exportAnimation(Animation animation){ + public String exportAnimation(Animation animation){ String json = createJson(animation); - System.out.println("JSON: " + json); + return json; } /** @@ -49,8 +49,6 @@ private String createJson(Animation animation){ Frames[] frames = new Frames[keyframes.size()]; if(frames.length != spritesheet.getTotalNumberOfSprites()){ - //ERROR - System.out.println("ERROR"); throw new ExportAnimationException("Different dimensions of keyframes and sprites in spritesheet"); } @@ -208,12 +206,7 @@ public Layer(String name, int opacity, String blendMode){ this.blendMode = blendMode; } - } - - - - - + } } diff --git a/tests/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandlerTests.java b/tests/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandlerTests.java index ab145cc26..9694d28b9 100644 --- a/tests/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandlerTests.java +++ b/tests/de/gurkenlabs/litiengine/graphics/animation/AsepriteHandlerTests.java @@ -14,6 +14,9 @@ public class AsepriteHandlerTests { + /** + * Test that just create a json and prints in to standard output. + */ @Test public void exportAnimationTest() { String spritesheetPath = "C:/Users/Nikla/Documents/Programmering/SoftwareFundamentals/Assignment-3-EC/litiengine/tests/de/gurkenlabs/litiengine/graphics/animation/aseprite_test_animation/Sprite-0001-sheet.png"; @@ -22,7 +25,8 @@ public void exportAnimationTest() { Animation animation = new Animation(spritesheet, false, false, 2,2,2); AsepriteHandler aseprite = new AsepriteHandler(); - aseprite.exportAnimation(animation); + String result = aseprite.exportAnimation(animation); + System.out.println(result); } } \ No newline at end of file