1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/smil/test/db_smilCSSFromBy.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,141 @@ 1.4 +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 sw=2 sts=2 et: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +/* testcase data for simple "from-by" animations of CSS properties */ 1.11 + 1.12 +// NOTE: This js file requires db_smilCSSPropertyList.js 1.13 + 1.14 +// Lists of testcases for re-use across multiple properties of the same type 1.15 +var _fromByTestLists = 1.16 +{ 1.17 + color: [ 1.18 + new AnimTestcaseFromBy("rgb(10, 20, 30)", "currentColor", 1.19 + { midComp: "rgb(35, 45, 55)", 1.20 + toComp: "rgb(60, 70, 80)"}), 1.21 + new AnimTestcaseFromBy("currentColor", "rgb(30, 20, 10)", 1.22 + { fromComp: "rgb(50, 50, 50)", 1.23 + midComp: "rgb(65, 60, 55)", 1.24 + toComp: "rgb(80, 70, 60)"}), 1.25 + ], 1.26 + lengthNoUnits: [ 1.27 + new AnimTestcaseFromBy("0", "50", { fromComp: "0px", // 0 acts like 0px 1.28 + midComp: "25px", 1.29 + toComp: "50px"}), 1.30 + new AnimTestcaseFromBy("30", "10", { fromComp: "30px", 1.31 + midComp: "35px", 1.32 + toComp: "40px"}), 1.33 + ], 1.34 + lengthNoUnitsSVG: [ 1.35 + new AnimTestcaseFromBy("0", "50", { fromComp: "0", 1.36 + midComp: "25", 1.37 + toComp: "50"}), 1.38 + new AnimTestcaseFromBy("30", "10", { fromComp: "30", 1.39 + midComp: "35", 1.40 + toComp: "40"}), 1.41 + ], 1.42 + lengthPx: [ 1.43 + new AnimTestcaseFromBy("0px", "8px", { fromComp: "0px", 1.44 + midComp: "4px", 1.45 + toComp: "8px"}), 1.46 + new AnimTestcaseFromBy("1px", "10px", { midComp: "6px", toComp: "11px"}), 1.47 + ], 1.48 + opacity: [ 1.49 + new AnimTestcaseFromBy("1", "-1", { midComp: "0.5", toComp: "0"}), 1.50 + new AnimTestcaseFromBy("0.4", "-0.6", { midComp: "0.1", toComp: "0"}), 1.51 + new AnimTestcaseFromBy("0.8", "-1.4", { midComp: "0.1", toComp: "0"}, 1.52 + "opacities with abs val >1 get clamped too early"), 1.53 + new AnimTestcaseFromBy("1.2", "-0.6", { midComp: "0.9", toComp: "0.6"}, 1.54 + "opacities with abs val >1 get clamped too early"), 1.55 + ], 1.56 + paint: [ 1.57 + // The "none" keyword & URI values aren't addiditve, so the animations in 1.58 + // these testcases are expected to have no effect. 1.59 + new AnimTestcaseFromBy("none", "none", { noEffect: 1 }), 1.60 + new AnimTestcaseFromBy("url(#gradA)", "url(#gradB)", { noEffect: 1 }), 1.61 + new AnimTestcaseFromBy("url(#gradA)", "url(#gradB) red", { noEffect: 1 }), 1.62 + new AnimTestcaseFromBy("url(#gradA)", "none", { noEffect: 1 }), 1.63 + new AnimTestcaseFromBy("red", "url(#gradA)", { noEffect: 1 }), 1.64 + ], 1.65 + URIsAndNone: [ 1.66 + // No need to specify { noEffect: 1 }, since plain URI-valued properties 1.67 + // aren't additive 1.68 + new AnimTestcaseFromBy("url(#idA)", "url(#idB)"), 1.69 + new AnimTestcaseFromBy("none", "url(#idB)"), 1.70 + new AnimTestcaseFromBy("url(#idB)", "inherit"), 1.71 + ], 1.72 +}; 1.73 + 1.74 +// List of attribute/testcase-list bundles to be tested 1.75 +var gFromByBundles = 1.76 +[ 1.77 + new TestcaseBundle(gPropList.clip, [ 1.78 + new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)", 1.79 + "rect(10px, 20px, 30px, 40px)", 1.80 + { midComp: "rect(6px, 12px, 18px, 24px)", 1.81 + toComp: "rect(11px, 22px, 33px, 44px)"}), 1.82 + // Adding "auto" (either as a standalone value or a subcomponent value) 1.83 + // should cause animation to fail. 1.84 + new AnimTestcaseFromBy("auto", "auto", { noEffect: 1 }), 1.85 + new AnimTestcaseFromBy("auto", 1.86 + "rect(auto, auto, auto, auto)", { noEffect: 1 }), 1.87 + new AnimTestcaseFromBy("rect(auto, auto, auto, auto)", 1.88 + "rect(auto, auto, auto, auto)", { noEffect: 1 }), 1.89 + new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)", "auto", { noEffect: 1 }), 1.90 + new AnimTestcaseFromBy("auto", "rect(1px, 2px, 3px, 4px)", { noEffect: 1 }), 1.91 + new AnimTestcaseFromBy("rect(1px, 2px, 3px, auto)", 1.92 + "rect(10px, 20px, 30px, 40px)", { noEffect: 1 }), 1.93 + new AnimTestcaseFromBy("rect(1px, auto, 3px, 4px)", 1.94 + "rect(10px, auto, 30px, 40px)", { noEffect: 1 }), 1.95 + new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)", 1.96 + "rect(10px, auto, 30px, 40px)", { noEffect: 1 }), 1.97 + ]), 1.98 + // Check that 'by' animations for 'cursor' has no effect 1.99 + new TestcaseBundle(gPropList.cursor, [ 1.100 + new AnimTestcaseFromBy("crosshair", "move"), 1.101 + ]), 1.102 + new TestcaseBundle(gPropList.fill, [].concat(_fromByTestLists.color, 1.103 + _fromByTestLists.paint)), 1.104 + // Check that 'by' animations involving URIs have no effect 1.105 + new TestcaseBundle(gPropList.filter, _fromByTestLists.URIsAndNone), 1.106 + new TestcaseBundle(gPropList.font, [ 1.107 + new AnimTestcaseFromBy("10px serif", 1.108 + "normal normal 400 100px / 10px monospace"), 1.109 + ]), 1.110 + new TestcaseBundle(gPropList.font_size, 1.111 + [].concat(_fromByTestLists.lengthNoUnits, 1.112 + _fromByTestLists.lengthPx)), 1.113 + new TestcaseBundle(gPropList.font_size_adjust, [ 1.114 + // These testcases implicitly have no effect, because font-size-adjust is 1.115 + // non-additive (and is declared as such in db_smilCSSPropertyList.js) 1.116 + new AnimTestcaseFromBy("0.5", "0.1"), 1.117 + new AnimTestcaseFromBy("none", "0.1"), 1.118 + new AnimTestcaseFromBy("0.1", "none") 1.119 + ]), 1.120 + new TestcaseBundle(gPropList.lighting_color, _fromByTestLists.color), 1.121 + new TestcaseBundle(gPropList.marker, _fromByTestLists.URIsAndNone), 1.122 + new TestcaseBundle(gPropList.marker_end, _fromByTestLists.URIsAndNone), 1.123 + new TestcaseBundle(gPropList.marker_mid, _fromByTestLists.URIsAndNone), 1.124 + new TestcaseBundle(gPropList.marker_start, _fromByTestLists.URIsAndNone), 1.125 + new TestcaseBundle(gPropList.overflow, [ 1.126 + new AnimTestcaseFromBy("inherit", "auto"), 1.127 + new AnimTestcaseFromBy("scroll", "hidden") 1.128 + ]), 1.129 + new TestcaseBundle(gPropList.opacity, _fromByTestLists.opacity), 1.130 + new TestcaseBundle(gPropList.stroke_miterlimit, [ 1.131 + new AnimTestcaseFromBy("1", "1", { midComp: "1.5", toComp: "2" }), 1.132 + new AnimTestcaseFromBy("20.1", "-10", { midComp: "15.1", toComp: "10.1" }), 1.133 + ]), 1.134 + new TestcaseBundle(gPropList.stroke_dasharray, [ 1.135 + // These testcases implicitly have no effect, because stroke-dasharray is 1.136 + // non-additive (and is declared as such in db_smilCSSPropertyList.js) 1.137 + new AnimTestcaseFromBy("none", "5"), 1.138 + new AnimTestcaseFromBy("10", "5"), 1.139 + new AnimTestcaseFromBy("1", "2, 3"), 1.140 + ]), 1.141 + new TestcaseBundle(gPropList.stroke_width, 1.142 + [].concat(_fromByTestLists.lengthNoUnitsSVG, 1.143 + _fromByTestLists.lengthPx)) 1.144 +];