From 8f4f9d9b0a5832711378dba429efa5673f4809ba Mon Sep 17 00:00:00 2001 From: juliandescottes Date: Sun, 14 May 2017 15:55:46 +0200 Subject: [PATCH] Fix #689 - add unit test for v0 deserializer --- .../serialization/Deserializer_v0Test.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/js/utils/serialization/Deserializer_v0Test.js diff --git a/test/js/utils/serialization/Deserializer_v0Test.js b/test/js/utils/serialization/Deserializer_v0Test.js new file mode 100644 index 00000000..653961ec --- /dev/null +++ b/test/js/utils/serialization/Deserializer_v0Test.js @@ -0,0 +1,25 @@ +describe("Deserializer v0 test", function() { + + var black = '#000000'; + var transparent = Constants.TRANSPARENT_COLOR; + var data = [ + [ + ["#000000", "TRANSPARENT"], + ["TRANSPARENT", "#000000"] + ] + ]; + + it("deserializes data serialized for model v0 correctly", function (done) { + var deserializer = pskl.utils.serialization.Deserializer; + deserializer.deserialize(data, function (p) { + // Check the frame has been properly deserialized + expect(p.getLayerAt(0).getFrames().length).toBe(1); + var frame = p.getLayerAt(0).getFrameAt(0); + test.testutils.frameEqualsGrid(frame, [ + [black, transparent], + [transparent, black] + ]); + done(); + }); + }); +});