From fd40c1a829d986c3951b6e4fbb03748a55482090 Mon Sep 17 00:00:00 2001
From: Ian Gilman <ian@iangilman.com>
Date: Tue, 2 Dec 2014 13:29:52 -0800
Subject: [PATCH] Test for tiledImage animation

---
 test/modules/tiledimage.js | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/test/modules/tiledimage.js b/test/modules/tiledimage.js
index 3fc5d217..44dc9327 100644
--- a/test/modules/tiledimage.js
+++ b/test/modules/tiledimage.js
@@ -85,6 +85,32 @@
         });
     });
 
+    // ----------
+    asyncTest('animation', function() {
+        viewer.addHandler("open", function () {
+            var image = viewer.world.getItemAt(0);
+            propEqual(image.getBounds(), new OpenSeadragon.Rect(0, 0, 1, 1), 'target bounds on open');
+            propEqual(image.getBounds(true), new OpenSeadragon.Rect(0, 0, 1, 1), 'current bounds on open');
+
+            image.setPosition(new OpenSeadragon.Point(1, 2));
+            propEqual(image.getBounds(), new OpenSeadragon.Rect(1, 2, 1, 1), 'target bounds after position');
+            propEqual(image.getBounds(true), new OpenSeadragon.Rect(0, 0, 1, 1), 'current bounds after position');
+
+            image.setWidth(3);
+            propEqual(image.getBounds(), new OpenSeadragon.Rect(1, 2, 3, 3), 'target bounds after width');
+            propEqual(image.getBounds(true), new OpenSeadragon.Rect(0, 0, 1, 1), 'current bounds after width');
+
+            viewer.addHandler('animation-finish', function animationHandler() {
+                viewer.removeHandler('animation-finish', animationHandler);
+                propEqual(image.getBounds(), new OpenSeadragon.Rect(1, 2, 3, 3), 'target bounds after animation');
+                propEqual(image.getBounds(true), new OpenSeadragon.Rect(1, 2, 3, 3), 'current bounds after animation');
+                start();
+            });
+        });
+
+        viewer.open('/test/data/testpattern.dzi');
+    });
+
     // ----------
     asyncTest('update', function() {
         var handlerCount = 0;