Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
7 /* testcase data for simple "from-by" animations of CSS properties */
9 // NOTE: This js file requires db_smilCSSPropertyList.js
11 // Lists of testcases for re-use across multiple properties of the same type
12 var _fromByTestLists =
13 {
14 color: [
15 new AnimTestcaseFromBy("rgb(10, 20, 30)", "currentColor",
16 { midComp: "rgb(35, 45, 55)",
17 toComp: "rgb(60, 70, 80)"}),
18 new AnimTestcaseFromBy("currentColor", "rgb(30, 20, 10)",
19 { fromComp: "rgb(50, 50, 50)",
20 midComp: "rgb(65, 60, 55)",
21 toComp: "rgb(80, 70, 60)"}),
22 ],
23 lengthNoUnits: [
24 new AnimTestcaseFromBy("0", "50", { fromComp: "0px", // 0 acts like 0px
25 midComp: "25px",
26 toComp: "50px"}),
27 new AnimTestcaseFromBy("30", "10", { fromComp: "30px",
28 midComp: "35px",
29 toComp: "40px"}),
30 ],
31 lengthNoUnitsSVG: [
32 new AnimTestcaseFromBy("0", "50", { fromComp: "0",
33 midComp: "25",
34 toComp: "50"}),
35 new AnimTestcaseFromBy("30", "10", { fromComp: "30",
36 midComp: "35",
37 toComp: "40"}),
38 ],
39 lengthPx: [
40 new AnimTestcaseFromBy("0px", "8px", { fromComp: "0px",
41 midComp: "4px",
42 toComp: "8px"}),
43 new AnimTestcaseFromBy("1px", "10px", { midComp: "6px", toComp: "11px"}),
44 ],
45 opacity: [
46 new AnimTestcaseFromBy("1", "-1", { midComp: "0.5", toComp: "0"}),
47 new AnimTestcaseFromBy("0.4", "-0.6", { midComp: "0.1", toComp: "0"}),
48 new AnimTestcaseFromBy("0.8", "-1.4", { midComp: "0.1", toComp: "0"},
49 "opacities with abs val >1 get clamped too early"),
50 new AnimTestcaseFromBy("1.2", "-0.6", { midComp: "0.9", toComp: "0.6"},
51 "opacities with abs val >1 get clamped too early"),
52 ],
53 paint: [
54 // The "none" keyword & URI values aren't addiditve, so the animations in
55 // these testcases are expected to have no effect.
56 new AnimTestcaseFromBy("none", "none", { noEffect: 1 }),
57 new AnimTestcaseFromBy("url(#gradA)", "url(#gradB)", { noEffect: 1 }),
58 new AnimTestcaseFromBy("url(#gradA)", "url(#gradB) red", { noEffect: 1 }),
59 new AnimTestcaseFromBy("url(#gradA)", "none", { noEffect: 1 }),
60 new AnimTestcaseFromBy("red", "url(#gradA)", { noEffect: 1 }),
61 ],
62 URIsAndNone: [
63 // No need to specify { noEffect: 1 }, since plain URI-valued properties
64 // aren't additive
65 new AnimTestcaseFromBy("url(#idA)", "url(#idB)"),
66 new AnimTestcaseFromBy("none", "url(#idB)"),
67 new AnimTestcaseFromBy("url(#idB)", "inherit"),
68 ],
69 };
71 // List of attribute/testcase-list bundles to be tested
72 var gFromByBundles =
73 [
74 new TestcaseBundle(gPropList.clip, [
75 new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
76 "rect(10px, 20px, 30px, 40px)",
77 { midComp: "rect(6px, 12px, 18px, 24px)",
78 toComp: "rect(11px, 22px, 33px, 44px)"}),
79 // Adding "auto" (either as a standalone value or a subcomponent value)
80 // should cause animation to fail.
81 new AnimTestcaseFromBy("auto", "auto", { noEffect: 1 }),
82 new AnimTestcaseFromBy("auto",
83 "rect(auto, auto, auto, auto)", { noEffect: 1 }),
84 new AnimTestcaseFromBy("rect(auto, auto, auto, auto)",
85 "rect(auto, auto, auto, auto)", { noEffect: 1 }),
86 new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)", "auto", { noEffect: 1 }),
87 new AnimTestcaseFromBy("auto", "rect(1px, 2px, 3px, 4px)", { noEffect: 1 }),
88 new AnimTestcaseFromBy("rect(1px, 2px, 3px, auto)",
89 "rect(10px, 20px, 30px, 40px)", { noEffect: 1 }),
90 new AnimTestcaseFromBy("rect(1px, auto, 3px, 4px)",
91 "rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
92 new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
93 "rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
94 ]),
95 // Check that 'by' animations for 'cursor' has no effect
96 new TestcaseBundle(gPropList.cursor, [
97 new AnimTestcaseFromBy("crosshair", "move"),
98 ]),
99 new TestcaseBundle(gPropList.fill, [].concat(_fromByTestLists.color,
100 _fromByTestLists.paint)),
101 // Check that 'by' animations involving URIs have no effect
102 new TestcaseBundle(gPropList.filter, _fromByTestLists.URIsAndNone),
103 new TestcaseBundle(gPropList.font, [
104 new AnimTestcaseFromBy("10px serif",
105 "normal normal 400 100px / 10px monospace"),
106 ]),
107 new TestcaseBundle(gPropList.font_size,
108 [].concat(_fromByTestLists.lengthNoUnits,
109 _fromByTestLists.lengthPx)),
110 new TestcaseBundle(gPropList.font_size_adjust, [
111 // These testcases implicitly have no effect, because font-size-adjust is
112 // non-additive (and is declared as such in db_smilCSSPropertyList.js)
113 new AnimTestcaseFromBy("0.5", "0.1"),
114 new AnimTestcaseFromBy("none", "0.1"),
115 new AnimTestcaseFromBy("0.1", "none")
116 ]),
117 new TestcaseBundle(gPropList.lighting_color, _fromByTestLists.color),
118 new TestcaseBundle(gPropList.marker, _fromByTestLists.URIsAndNone),
119 new TestcaseBundle(gPropList.marker_end, _fromByTestLists.URIsAndNone),
120 new TestcaseBundle(gPropList.marker_mid, _fromByTestLists.URIsAndNone),
121 new TestcaseBundle(gPropList.marker_start, _fromByTestLists.URIsAndNone),
122 new TestcaseBundle(gPropList.overflow, [
123 new AnimTestcaseFromBy("inherit", "auto"),
124 new AnimTestcaseFromBy("scroll", "hidden")
125 ]),
126 new TestcaseBundle(gPropList.opacity, _fromByTestLists.opacity),
127 new TestcaseBundle(gPropList.stroke_miterlimit, [
128 new AnimTestcaseFromBy("1", "1", { midComp: "1.5", toComp: "2" }),
129 new AnimTestcaseFromBy("20.1", "-10", { midComp: "15.1", toComp: "10.1" }),
130 ]),
131 new TestcaseBundle(gPropList.stroke_dasharray, [
132 // These testcases implicitly have no effect, because stroke-dasharray is
133 // non-additive (and is declared as such in db_smilCSSPropertyList.js)
134 new AnimTestcaseFromBy("none", "5"),
135 new AnimTestcaseFromBy("10", "5"),
136 new AnimTestcaseFromBy("1", "2, 3"),
137 ]),
138 new TestcaseBundle(gPropList.stroke_width,
139 [].concat(_fromByTestLists.lengthNoUnitsSVG,
140 _fromByTestLists.lengthPx))
141 ];