summaryrefslogtreecommitdiffstats
path: root/dom/smil/test/smilAnimateMotionValueLists.js
blob: 364bc250ef8f9b1003fad11dda6b50d22b7029e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 sw=2 sts=2 et: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Lists of valid & invalid values for the various <animateMotion> attributes */
const gValidValues = [
  "10 10",
  "10 10;",  // Trailing semicolons are allowed
  "10 10;  ",
  "   10   10em  ",
  "1 2  ; 3,4",
  "1,2;3,4",
  "0 0",
  "0,0",
];

const gInvalidValues = [
  ";10 10",
  "10 10;;",
  "1 2 3",
  "1 2 3 4",
  "1,2;3,4 ,",
  ",", " , ",
  ";", " ; ",
  "a", " a; ", ";a;",
  "", " ",
  "1,2;3,4,",
  "1,,2",
  ",1,2",
];

const gValidRotate = [
  "10",
  "20.1",
  "30.5deg",
  "0.5rad",
  "auto",
  "auto-reverse"
];

const gInvalidRotate = [
  " 10 ",
  "  10deg",
  "10 deg",
  "10deg ",
  "10 rad    ",
  "aaa",
  " 10.1 ",
];

const gValidToBy = [
 "0 0",
 "1em,2",
 "50.3em 0.2in",
 " 1,2",
 "1 2 "
];

const gInvalidToBy = [
 "0 0 0",
 "0 0,0",
 "0,0,0",
 "1emm 2",
 "1 2;",
 "1 2,",
 " 1,2 ,",
 "abc",
 ",",
 "",
 "1,,2",
 "1,2,"
];

const gValidPath = [
 "m0 0     L30 30",
 "M20,20L10    10",
 "M20,20 L30, 30h20",
 "m50 50", "M50 50",
 "m0 0", "M0, 0"
];

// paths must start with at least a valid "M" segment to be valid
const gInvalidPath = [
 "M20in 20",
 "h30",
 "L50 50",
 "abc",
];

// paths that at least start with a valid "M" segment are valid - the spec says
// to parse everything up to the first invalid token
const gValidPathWithErrors = [
 "M20 20em",
 "m0 0 L30,,30",
 "M10 10 L50 50 abc",
];

const gValidKeyPoints = [
  "0; 0.5; 1",
  "0;.5;1",
  "0; 0; 1",
  "0; 1; 1",
  "0; 0; 1;", // Trailing semicolons are allowed
  "0; 0; 1; ",
  "0; 0.000; 1",
  "0; 0.000001; 1",
];

// Should have 3 values to be valid.
// Same as number of keyTimes values
const gInvalidKeyPoints = [
  "0; 1",
  "0; 0.5; 0.75; 1",
  "0; 1;",
  "0",
  "1",
  "a",
  "",
  "  ",
  "0; -0.1; 1",
  "0; 1.1; 1",
  "0; 0.1; 1.1",
  "-0.1; 0.1; 1",
  "0; a; 1",
  "0;;1",
];