smilAnimateMotionValueLists.js (2090B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* vim: set ts=2 sw=2 sts=2 et: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* Lists of valid & invalid values for the various <animateMotion> attributes */ 8 const gValidValues = [ 9 "10 10", 10 "10 10;", // Trailing semicolons are allowed 11 "10 10; ", 12 " 10 10em ", 13 "1 2 ; 3,4", 14 "1,2;3,4", 15 "0 0", 16 "0,0", 17 ]; 18 19 const gInvalidValues = [ 20 ";10 10", 21 "10 10;;", 22 "1 2 3", 23 "1 2 3 4", 24 "1,2;3,4 ,", 25 ",", 26 " , ", 27 ";", 28 " ; ", 29 "a", 30 " a; ", 31 ";a;", 32 "", 33 " ", 34 "1,2;3,4,", 35 "1,,2", 36 ",1,2", 37 ]; 38 39 const gValidRotate = [ 40 "10", 41 "20.1", 42 "30.5deg", 43 "0.5rad", 44 "auto", 45 "auto-reverse", 46 " 10 ", 47 " 10deg", 48 "10deg ", 49 " 10.1 ", 50 ]; 51 52 const gInvalidRotate = ["10 deg", "10 rad ", "aaa"]; 53 54 const gValidToBy = ["0 0", "1em,2", "50.3em 0.2in", " 1,2", "1 2 "]; 55 56 const gInvalidToBy = [ 57 "0 0 0", 58 "0 0,0", 59 "0,0,0", 60 "1emm 2", 61 "1 2;", 62 "1 2,", 63 " 1,2 ,", 64 "abc", 65 ",", 66 "", 67 "1,,2", 68 "1,2,", 69 ]; 70 71 const gValidPath = [ 72 "m0 0 L30 30", 73 "M20,20L10 10", 74 "M20,20 L30, 30h20", 75 "m50 50", 76 "M50 50", 77 "m0 0", 78 "M0, 0", 79 ]; 80 81 // paths must start with at least a valid "M" segment to be valid 82 const gInvalidPath = ["M20in 20", "h30", "L50 50", "abc"]; 83 84 // paths that at least start with a valid "M" segment are valid - the spec says 85 // to parse everything up to the first invalid token 86 const gValidPathWithErrors = ["M20 20em", "m0 0 L30,,30", "M10 10 L50 50 abc"]; 87 88 const gValidKeyPoints = [ 89 "0; 0.5; 1", 90 "0;.5;1", 91 "0; 0; 1", 92 "0; 1; 1", 93 "0; 0; 1;", // Trailing semicolons are allowed 94 "0; 0; 1; ", 95 "0; 0.000; 1", 96 "0; 0.000001; 1", 97 ]; 98 99 // Should have 3 values to be valid. 100 // Same as number of keyTimes values 101 const gInvalidKeyPoints = [ 102 "0; 1", 103 "0; 0.5; 0.75; 1", 104 "0; 1;", 105 "0", 106 "1", 107 "a", 108 "", 109 " ", 110 "0; -0.1; 1", 111 "0; 1.1; 1", 112 "0; 0.1; 1.1", 113 "-0.1; 0.1; 1", 114 "0; a; 1", 115 "0;;1", 116 ];