OSDN Git Service

Modify an offset method object
authordhrname <dhrname@users.sourceforge.jp>
Sat, 31 Jan 2015 11:48:46 +0000 (20:48 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sat, 31 Jan 2015 11:48:46 +0000 (20:48 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index ba52a7b..fb9a40a 100644 (file)
@@ -207,8 +207,7 @@ base("$frame").mix ( {
       return s;\r
       \r
       function ms() {\r
-        var deg = str.match(/[\d.]+ms$/) || "0";\r
-        return ( parseFloat(deg) );\r
+        return  parseFloat( str.match(/[\d.]+ms$/) || "0");\r
       };\r
       function sec() {\r
         var deg = str.match(/:[\d.]+$/) || "0",\r
@@ -224,7 +223,7 @@ base("$frame").mix ( {
       };\r
       function h() {\r
         var deg = str.match(/\d+:\d\d:/) || "0",\r
-            de = str.match(/\d+h$/) || "0";\r
+            de = str.match(/[\d.]+h$/) || "0";\r
         return ( 3600000*( parseFloat(deg) || parseFloat(de) ) );\r
       };\r
     },\r
index 219e356..c065ca5 100644 (file)
@@ -2218,22 +2218,26 @@ describe("SMIL Animation Spec", function() {
         expect(begin.offset("-121s")).toEqual(-121 * 1000);\r
         expect(begin.offset("1.25s")).toEqual(1.25 * 1000);\r
         expect(begin.offset("-0.20s")).toEqual(-0.20 * 1000);\r
+        expect(begin.offset(".20s")).toEqual(0.20 * 1000);\r
 \r
-        expect(begin.offset("+0min")).toEqual(0);\r
-        expect(begin.offset("-0min")).toEqual(0);\r
-        expect(begin.offset("1min")).toEqual(60000);\r
-        expect(begin.offset("-1min")).toEqual(-60000);\r
+        expect(begin.offset("+100min")).toEqual(100 * 60000);\r
+        expect(begin.offset("-121min")).toEqual(-121 * 60000);\r
+        expect(begin.offset("1.25min")).toEqual(1.25 * 60000);\r
+        expect(begin.offset("-0.20min")).toEqual(-0.20 * 60000);\r
+        expect(begin.offset(".20min")).toEqual(0.20 * 60000);\r
 \r
-        expect(begin.offset("+0h")).toEqual(0);\r
-        expect(begin.offset("-0h")).toEqual(0);\r
-        expect(begin.offset("1h")).toEqual(60*60*1000);\r
-        expect(begin.offset("-1h")).toEqual(-3600000);\r
+        expect(begin.offset("+100h")).toEqual(100 * 3600000);\r
+        expect(begin.offset("-121h")).toEqual(-121 * 3600000);\r
+        expect(begin.offset("1.25h")).toEqual(1.25 * 3600000);\r
+        expect(begin.offset("-0.20h")).toEqual(-0.20 * 3600000);\r
+        expect(begin.offset(".20h")).toEqual(0.20 * 3600000);\r
       } );\r
       /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
       it("should be this for the value (the invalid partion)", function() {\r
-        begin.string = " h  o  g     e ";\r
+        begin.string = " h  o  g     1e ";\r
         expect(begin.offset(begin.trim())).toEqual(0);\r
         expect(begin.offset("ms")).toEqual(0);\r
+        expect(begin.offset(".s")).toEqual(0);\r
       } );\r
     } );\r
 \r