OSDN Git Service

Add the Spec for the additive attribute
authordhrname <dhrname@users.sourceforge.jp>
Wed, 23 Mar 2016 11:32:26 +0000 (20:32 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 23 Mar 2016 11:32:26 +0000 (20:32 +0900)
tool/Spec/spec/SvgDomSpec.js

index 9b4c464..5ff0cfd 100644 (file)
@@ -2624,19 +2624,22 @@ describe("SMIL Animation Spec", function() {
           expect($animate.tocall(0.1)).toBe("scale(0.1)");\r
           \r
           ele.setAttributeNS(null, "additive", "sum");\r
-          ele.parentNode.appendChild(ele.cloneNode(true));\r
-          ele.parentNode.__transformList = [];\r
+          var parentNode = ele.parentNode;\r
+          parentNode.appendChild(ele.cloneNode(true));\r
+          parentNode.__transformList = [];\r
+          /*additive属性のsumとreplaceの混合を避けるため、eleを削除*/\r
+          parentNode.removeChild(ele);\r
           $animate.numberOfList = -1;\r
-          $animate.init(ele.parentNode.lastChild);\r
+          $animate.init(parentNode.lastChild);\r
           expect($animate.numberOfList).toBe(0);\r
           expect($animate.tocall(0)).toBe("matrix(0 0 0 0 0 0) scale(0.0)");\r
           expect($animate.tocall(1)).toBe("matrix(0 0 0 0 0 0) scale(1.0)");\r
           \r
-          ele.parentNode.appendChild(ele.cloneNode(true));\r
+          parentNode.appendChild(ele.cloneNode(true));\r
           $animate.up("$a").numberOfList = -1;\r
-          ele.parentNode.__transformList = [];\r
-          ele.parentNode.setAttribute("transform", "matrix(0 0 0 0 0 0)");\r
-          $animate.$a.init(ele.parentNode.lastChild);\r
+          parentNode.__transformList = [];\r
+          parentNode.setAttribute("transform", "matrix(0 0 0 0 0 0)");\r
+          $animate.$a.init(parentNode.lastChild);\r
           expect($animate.$a.numberOfList).toBe(0);\r
           expect($animate.$a.isDefault).toBeTruthy();\r
           expect($animate.$a.defaultValue).toBe("matrix(0 0 0 0 0 0)");\r
@@ -2644,6 +2647,27 @@ describe("SMIL Animation Spec", function() {
           expect($animate.$a.tocall(1)).toBe("matrix(0 0 0 0 0 0) scale(1.0)");\r
           $animate.defaultValue = $animate.$a.defaultValue;\r
           expect($animate.tocall(0.1)).toBe("matrix(0 0 0 0 0 0) scale(0.1)");\r
+          \r
+          /*子要素を全部消す*/\r
+          while (parentNode.firstChild) {\r
+            parentNode.removeChild(parentNode.firstChild);\r
+          }\r
+          \r
+          /*additive属性のreplaceとsumの混合*/\r
+          ele.removeAttributeNS(null, "additive");\r
+          parentNode.appendChild(ele.cloneNode(true));\r
+          ele.setAttributeNS(null, "additive", "sum");\r
+          parentNode.appendChild(ele.cloneNode(true));\r
+          parentNode.__transformList = [];\r
+          $animate.numberOfList = -1;\r
+          parentNode.setAttribute("transform", "matrix(0 0 0 0 0 0)");\r
+          $animate.up("$b").init(parentNode.firstChild);\r
+          $animate.up("$c").init(parentNode.lastChild);\r
+          expect($animate.numberOfList).toBe(0);\r
+          expect($animate.$b.tocall(0)).toBe("scale(0.0)");\r
+          expect($animate.$c.tocall(0)).toBe("scale(0.0) scale(0.0)");\r
+          expect($animate.$b.tocall(1)).toBe("scale(1.0)");\r
+          expect($animate.$c.tocall(1)).toBe("scale(1.0) scale(1.0)");\r
         } );\r
         /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
         it("should be this for the value (the invalid partion )", function() {\r