Bug 1294614 - Part 1: Test cases for SMIL animation for RGBA colors. r=dholbert

The second test case in db_smilCSSFromBy.js

MozReview-Commit-ID: 5l6d9NTuJ9N

--HG--
extra : rebase_source : ef329e159d82ec19d50b77560454d235a6824291
This commit is contained in:
Hiroyuki Ikezoe 2016-08-25 09:08:34 +09:00
Родитель 2445bd484f
Коммит c9e63c2749
3 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -19,6 +19,23 @@ var _fromByTestLists =
{ fromComp: "rgb(50, 50, 50)",
midComp: "rgb(65, 60, 55)",
toComp: "rgb(80, 70, 60)"}),
new AnimTestcaseFromBy("rgba(10, 20, 30, 0.2)", "rgba(50, 50, 50, 1)",
// (rgb(10, 20, 30) * 0.2 * 0.5 + rgb(52, 54, 56) * 1.0 * 0.5) * (1 / 0.6)
{ midComp: "rgba(45, 48, 52, 0.6)",
// (rgb(10, 20, 30) * 0.2 + rgb(50, 50, 50) * 1) / 1.0
toComp: "rgb(52, 54, 56)"}),
// Note: technically, the "from" and "by" values in the test case below
// would overflow the maxium color-channel values when added together.
// (e.g. for red [ignoring alpha for now], 100 + 240 = 340 which is > 255)
// The SVG Animation spec says we should clamp color values "as late as
// possible," i.e. allow the channel overflow and clamp at paint-time.
// But for now, we instead clamp the implicit "to" value for the animation
// and interpolate up to that clamped result.
new AnimTestcaseFromBy("rgba(100, 100, 100, 0.8)", "rgba(240, 240, 240, 1)",
// (rgb(100, 100, 100) * 0.8 * 0.5 + rgb(255, 255, 255) * 1.0 * 0.5) * (1 / 0.9)
{ midComp: "rgba(186, 186, 186, 0.9)",
// (rgb(100, 100, 100) * 0.8 + rgb(240, 240, 240) is overflowed
toComp: "rgb(255, 255, 255)"}),
],
lengthNoUnits: [
new AnimTestcaseFromBy("0", "50", { fromComp: "0px", // 0 acts like 0px

Просмотреть файл

@ -33,6 +33,10 @@ var _fromToTestLists = {
new AnimTestcaseFromTo("currentColor", "rgb(100, 100, 100)",
{ fromComp: "rgb(50, 50, 50)",
midComp: "rgb(75, 75, 75)" }),
new AnimTestcaseFromTo("rgba(10, 20, 30, 0.2)", "rgba(50, 50, 50, 1)",
// (rgb(10, 20, 30) * 0.2 * 0.5 + rgb(50, 50, 50) * 1.0 * 0.5) * (1 / 0.6)
{ midComp: "rgba(43, 45, 47, 0.6)",
toComp: "rgb(50, 50, 50)"}),
],
colorFromInheritBlack: [
new AnimTestcaseFromTo("inherit", "rgb(200, 200, 200)",

Просмотреть файл

@ -37,6 +37,17 @@ var _pacedTestLists =
comp2_3: "rgb(128, 100, 128)",
comp1: "rgb(206, 150, 206)"
}),
// Use the same RGB component values to make
// premultication effect easier to compute.
new AnimTestcasePaced("rgba(20, 40, 60, 0.2); " +
"rgba(20, 40, 60, 0.4); " +
"rgba(20, 40, 60, 0.8)",
{ comp0: "rgba(20, 40, 60, 0.2)",
comp1_6: "rgba(20, 40, 60, 0.3)",
comp1_3: "rgba(20, 40, 60, 0.4)",
comp2_3: "rgba(20, 40, 60, 0.6)",
comp1: "rgba(20, 40, 60, 0.8)"
}),
],
paintServer : [
// Sanity check: These aren't interpolatable -- they should end up