Bug 1367283 - Part 9: Add tests to confirm valid 'inherit' value of -moz prefixed properties during animation. r=hiro

Test to confirm valid 'inherit' value of -moz prefixed properties during
animation. This also means to confirm the algorithm of clone_XX methods
of stylo.
NOTE: This file should have only animatable properties that have '-moz' prefix.

In this patch, appends following properties.

* -moz-box-align
* -moz-box-direction
* -moz-box-orient
* -moz-box-pack
* -moz-float-edge
* -moz-orient
* -moz-osx-font-smoothing
* -moz-user-focus
* -moz-user-input
* -moz-user-modify
* -moz-window-dragging

MozReview-Commit-ID: GfBfMkvfgGm

--HG--
extra : rebase_source : f2e220ccc0c6864ad15416a2cda470f64eeb62be
This commit is contained in:
Daisuke Akatsuka 2017-05-30 10:42:59 +09:00
Родитель ecc0e24787
Коммит d27e5208ee
2 изменённых файлов: 89 добавлений и 0 удалений

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

@ -59,6 +59,7 @@ support-files =
style/file_composite.html
style/file_missing-keyframe.html
style/file_missing-keyframe-on-compositor.html
../../../layout/style/test/property_database.js
testcommon.js
[css-animations/test_animations-dynamic-changes.html]
@ -106,6 +107,7 @@ support-files =
[mozilla/test_discrete-animations.html]
[mozilla/test_document-timeline-origin-time-range.html]
[mozilla/test_hide_and_show.html]
[mozilla/test_moz-prefixed-properties.html]
[mozilla/test_set-easing.html]
[mozilla/test_spacing_property_order.html]
[mozilla/test_transform_limits.html]

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

@ -0,0 +1,87 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test animations of all properties that have -moz prefix</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
<script src="../property_database.js"></script>
</head>
<body>
<div id="log"></div>
<script>
"use strict";
const testcases = [
{
property: "-moz-box-align"
},
{
property: "-moz-box-direction"
},
{
property: "-moz-box-orient",
expectedValueMap: {
"block-axis": "vertical",
"inline-axis": "horizontal",
}
},
{
property: "-moz-box-pack"
},
{
property: "-moz-float-edge"
},
{
property: "-moz-orient"
},
{
property: "-moz-osx-font-smoothing",
pref: "layout.css.osx-font-smoothing.enabled"
},
{
property: "-moz-user-focus"
},
{
property: "-moz-user-input"
},
{
property: "-moz-user-modify"
},
{
property: "-moz-window-dragging"
},
];
testcases.forEach(testcase => {
if (testcase.pref && !IsCSSPropertyPrefEnabled(testcase.pref)) {
return;
}
const property = gCSSProperties[testcase.property];
const values = property.initial_values.concat(property.other_values);
values.forEach(value => {
test(function(t) {
const container = addDiv(t);
const target = document.createElement("div");
container.appendChild(target);
container.style[property.domProp] = value;
const animation =
target.animate({ [property.domProp]: [value, "inherit"] },
{ duration: 1000, delay: -500 } );
const expectedValue =
testcase.expectedValueMap && testcase.expectedValueMap[value]
? testcase.expectedValueMap[value] : value;
assert_equals(getComputedStyle(target)[property.domProp], expectedValue,
`Computed style shoud be "${ expectedValue }"`);
}, `Test inherit value for "${ testcase.property }" `
+ `(Parent element style is "${ value }")`);
});
});
</script>
</pre>
</body>
</html>