Update web-platform-tests to revision 7b078f0d6ff82157c57f343838f61b5200686e53

This commit is contained in:
WPT Sync Bot 2018-10-29 22:02:09 -04:00
parent 2f8dc65519
commit 5682eb7930
39 changed files with 1136 additions and 338 deletions

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#containing-block-details">
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#anonymous-block-level">
<style>
.rel { position:relative; }
.inline-block { display:inline-block; width:100px; height:1px; }
.inline-block.large { width:200px; }
#target { position:absolute; width:100%; height:100px; background:green; }
</style>
<p>There should be a green square below.</p>
<div style="height:200px;">
<span class="rel" id="notContainingBlockOfTarget">
<div class="large inline-block"></div>
<br>
<span id="containingBlockOfTarget" class="rel">
<div class="inline-block"></div>
<span>
<div>
<div id="target"></div>
</div>
</span>
<div class="inline-block"></div></span><br>
<div class="large inline-block"></div>
</span>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(()=> {
assert_equals(document.getElementById("target").offsetWidth, 100);
}, "Make sure that we're sized by the right ancestor");
</script>

View file

@ -29,7 +29,7 @@ for (let element of [divWithFontSizeSet, divWithFontSizeInherited]) {
// Because we want to include the parsing step, insert a stylesheet
// node with textContent.
let node = document.createElement('style');
node.textContent = `#${id} { ${name}: ${value}; }`;
node.textContent = `#${id} { ${name}:${value}; }`;
document.body.append(node);
try {
@ -123,5 +123,29 @@ for (let element of [divWithFontSizeSet, divWithFontSizeInherited]) {
test(function() {
assert_computed_value('<integer>+', '15 calc(2.4) calc(2.6)', '15 2 3');
}, "<integer>+ values are computed correctly for " + id);
test(function() {
assert_computed_value('<color>', '#ff0000', 'rgb(255, 0, 0)');
assert_computed_value('<color>', '#000f00', 'rgb(0, 15, 0)');
assert_computed_value('<color>', '#00000a', 'rgb(0, 0, 10)');
assert_computed_value('<color>', '#badbee', 'rgb(186, 219, 238)');
assert_computed_value('<color>', '#badbee33', 'rgba(186, 219, 238, 0.2)');
assert_computed_value('<color>', 'tomato', 'rgb(255, 99, 71)');
assert_computed_value('<color>', 'plum', 'rgb(221, 160, 221)');
assert_computed_value('<color>', 'currentcolor', 'currentcolor');
}, "<color> values are computed correctly for " + id);
test(function() {
assert_computed_value('*', 'tomato', 'tomato');
assert_computed_value('tomato | plum', 'plum', 'plum');
assert_computed_value('tomato | plum | <color>', 'plum', 'plum');
}, "ident values that look like color keywords are not converted to colors" + id);
test(function() {
assert_computed_value('*', '-50grad', '-50grad');
assert_computed_value('<angle>', '180deg', '180deg');
assert_computed_value('<angle>', '400grad', '360deg');
assert_computed_value('<angle>', 'calc(360deg + 400grad)', '720deg');
}, "<angle> values computed correctly for " + id);
}
</script>

View file

@ -46,7 +46,7 @@ test(function() {
assert_equals(inlineStyle.getPropertyValue('--length'), '5');
assert_equals(inlineStyle.getPropertyValue('--color'), 'hello');
assert_equals(computedStyle.getPropertyValue('--length'), '0px');
assert_equals(computedStyle.getPropertyValue('--color'), 'blue');
assert_equals(computedStyle.getPropertyValue('--color'), 'rgb(0, 0, 255)');
}, "Formerly valid values are still readable from inline styles but are computed as the unset value");
test(function() {
@ -62,7 +62,7 @@ test(function() {
assert_equals(inlineStyle.getPropertyValue('--length'), '');
assert_equals(inlineStyle.getPropertyValue('--color'), '');
assert_equals(computedStyle.getPropertyValue('--length'), '10px');
assert_equals(computedStyle.getPropertyValue('--color'), 'red');
assert_equals(computedStyle.getPropertyValue('--color'), 'rgb(255, 0, 0)');
}, "Values can be removed from inline styles");
test(function() {
@ -80,9 +80,9 @@ test(function() {
assert_equals(inlineStyle.getPropertyValue('--length'), '30px');
assert_equals(inlineStyle.getPropertyValue('--color'), 'pink');
assert_equals(computedStyle.getPropertyValue('--length'), '30px');
assert_equals(computedStyle.getPropertyValue('--color'), 'pink');
assert_equals(computedStyle.getPropertyValue('--color'), 'rgb(255, 192, 203)');
inlineStyle.setProperty('--color', 'inherit');
assert_equals(inlineStyle.getPropertyValue('--color'), 'inherit');
assert_equals(computedStyle.getPropertyValue('--color'), 'blue');
assert_equals(computedStyle.getPropertyValue('--color'), 'rgb(0, 0, 255)');
}, "Valid values can be set on inline styles");
</script>

View file

@ -23,8 +23,8 @@ test(function() {
computedStyle = getComputedStyle(target);
assert_equals(computedStyle.getPropertyValue('--length'), '25px');
assert_equals(computedStyle.getPropertyValue('--length-percentage'), 'calc(100px + 10%)');
assert_equals(computedStyle.getPropertyValue('--inherited-color'), 'pink');
assert_equals(computedStyle.getPropertyValue('--non-inherited-color'), 'purple');
assert_equals(computedStyle.getPropertyValue('--inherited-color'), 'rgb(255, 192, 203)');
assert_equals(computedStyle.getPropertyValue('--non-inherited-color'), 'rgb(128, 0, 128)');
assert_equals(computedStyle.getPropertyValue('--transform-function'), 'rotate(42deg)');
assert_equals(computedStyle.getPropertyValue('--single-transform-list'), 'scale(4)');
assert_equals(computedStyle.getPropertyValue('--multiple-transform-list'), 'scale(3) translateX(4px)');

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inheritance of Filter Effects properties</title>
<link rel="help" href="https://drafts.fxtf.org/filter-effects/#property-index">
<meta name="assert" content="Properties inherit according to the spec.">
<meta name="assert" content="Properties have initial values according to the spec.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/inheritance-testcommon.js"></script>
</head>
<body>
<div id="container">
<div id="target"></div>
</div>
<script>
assert_inherited('color-interpolation-filters', 'linearrgb', 'srgb');
assert_not_inherited('filter', 'none', 'blur(10px)');
assert_not_inherited('flood-color', 'rgb(0, 0, 0)', 'rgb(42, 53, 64)');
assert_not_inherited('flood-opacity', '1', '0.5');
assert_not_inherited('lighting-color', 'rgb(255, 255, 255)', 'rgb(42, 53, 64)');
</script>
</body>
</html>

View file

@ -0,0 +1,108 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Selectors Invalidation: :where()</title>
<link rel="author" title="Victoria Su" href="mailto:victoriaytsu@google.com">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#zero-matches">
<meta name="assert" content="This tests that the :where() selector is effective">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
* {
color: black;
}
.b {
color: yellow;
}
/*Simple selector arguments */
:where(.b, .c) {
color: red;
}
/*Compound selector arguments */
.a~:where(.c#d, .e) {
color: green;
}
/* Complex selector arguments */
.h {
color: red;
}
:where(.a~.h, .a~.h+.f) {
color: yellow;
}
/* Nested */
:where(.a>:where(.g+.h, .b)~.i) {
color: blue;
}
:where(:matches(.a~.h)) {
color: yellow;
}
</style>
</head>
<body>
<div id="a1">
<div class="g">
</div>
<div class="h">
</div>
<div class="i" id="i1">
Blue
</div>
</div>
<div class="b" id="b1">
Yellow
</div>
<div class="c" id="c1">
Red
</div>
<div class="c" id="d">
Green
</div>
<div class="h" id="h1">
Red
</div>
<div class="f" id="f1">
Yellow
</div>
<script>
document.body.offsetTop;
var black = "rgb(0, 0, 0)";
var green = "rgb(0, 128, 0)";
var red = "rgb(255, 0, 0)";
var yellow = "rgb(255, 255, 0)";
var blue = "rgb(0, 0, 255)";
test(() => {
assert_equals(getComputedStyle(b1).color, yellow);
assert_equals(getComputedStyle(c1).color, red);
assert_equals(getComputedStyle(d).color, red);
assert_equals(getComputedStyle(h1).color, red);
assert_equals(getComputedStyle(f1).color, black);
assert_equals(getComputedStyle(i1).color, black);
}, "Preconditions.");
test(() => {
a1.className = "a";
assert_equals(getComputedStyle(b1).color, yellow);
assert_equals(getComputedStyle(c1).color, red);
}, "Invalidate :where() for simple selector arguments.");
test(() => {
a1.className = "a";
assert_equals(getComputedStyle(d).color, green);
}, "Invalidate :where() for compound selector arguments.");
test(() => {
a1.className = "a";
assert_equals(getComputedStyle(h1).color, red);
assert_equals(getComputedStyle(f1).color, yellow);
}, "Invalidate :where() for complex selector arguments.");
test(() => {
a1.className = "a";
assert_equals(getComputedStyle(i1).color, blue);
}, "Invalidate nested :where().");
</script>
</body>
</html>

View file

@ -9,6 +9,12 @@ the [web platform][web-platform]; it excludes only ECMAScript (whose
testsuite lives in [test262][test262]) and WebGL (whose testsuite
lives in [WebGL][WebGL]).
## Watch a Talk
If you prefer watching a video, here is a talk introducing web-platform-tests:
<iframe width="560" height="315" src="https://www.youtube.com/embed/XnfE3MfH5hQ" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
## Help!
If you get stuck or want clarification about anything, feel free to

View file

@ -0,0 +1,23 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>Reference: Combobox ignores CSS 'line-height'</title>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<style type="text/css">
html,body {
color:black; background-color:white; font:16px/1 monospace;
}
</style>
</head>
<body>
<select><option>aaaaaaaaaa<option>bbbbbbbbbb</select>
</body>
</html>

View file

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>Test: Combobox ignores CSS 'line-height'</title>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="match" href="select-1-line-height-ref.html">
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-select-element-2">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1501908">
<style type="text/css">
html,body {
color:black; background-color:white; font:16px/1 monospace;
}
select { line-height:100px; }
</style>
</head>
<body>
<select><option>aaaaaaaaaa<option>bbbbbbbbbb</select>
<script>
document.body.offsetHeight;
var cv = window.getComputedStyle(document.querySelector('select')).lineHeight;
if (cv == "normal" || parseInt(cv) > 50) {
document.body.appendChild(document.createTextNode(
"FAIL: got computed line-height '" + cv + "', expected a length <= 50px"));
}</script>
</body>
</html>

View file

@ -5,8 +5,9 @@ function testTimeResolution(highResTimeFunc, funcString) {
while (t0 == t1) {
t1 = highResTimeFunc();
}
assert_greater_than_equal(t1 - t0, 0.02, 'The second ' + funcString + ' should be much greater than the first');
}, 'Verifies the resolution of ' + funcString + ' is at least 20 microseconds.');
const epsilon = 1e-5;
assert_greater_than_equal(t1 - t0, 0.005 - epsilon, 'The second ' + funcString + ' should be much greater than the first');
}, 'Verifies the resolution of ' + funcString + ' is at least 5 microseconds.');
}
function timeByPerformanceNow() {
@ -21,4 +22,4 @@ function timeByUserTiming() {
}
testTimeResolution(timeByPerformanceNow, 'performance.now()');
testTimeResolution(timeByUserTiming, 'entry.startTime');
testTimeResolution(timeByUserTiming, 'entry.startTime');

View file

@ -16,7 +16,7 @@ promise_test(async t => {
assert_not_equals(pipWindow.height, 0);
const videoAspectRatio = video.videoWidth / video.videoHeight;
const pipWindowAspectRatio = pipWindow.width / pipWindow.height;
assert_equals(videoAspectRatio, pipWindowAspectRatio);
assert_approx_equals(videoAspectRatio, pipWindowAspectRatio, 0.01);
});
}, 'Picture-in-Picture window dimensions are set after entering Picture-in-Picture');

View file

@ -305,7 +305,13 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options)
if (parsed[dep_type]) {
const inheriting = parsed[dep_type];
const inheritor = parsed.name || parsed.target;
for (const dep of [inheriting, inheritor]) {
const deps = [inheriting];
// For A includes B, we can ignore A unless B is being tested.
if (dep_type !== "includes"
|| (inheriting in this.members && !this.members[inheriting].untested)) {
deps.push(inheritor);
}
for (const dep of deps) {
new_options.only.push(dep);
all_deps.add(dep);
follow_up.add(dep);
@ -320,7 +326,7 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options)
next.forEach(process);
}
}
});
}.bind(this));
}.bind(this);
for (let parsed of parsed_idls) {

View file

@ -0,0 +1,32 @@
<!doctype html>
<meta charset=utf-8>
<title>use element reacts to attribute changes when it's not rendered</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="help" href="https://svgwg.org/svg2-draft/struct.html#UseElement">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1502658">
<link rel="match" href="/svg/linking/reftests/use-descendant-combinator-ref.html">
<style>
</style>
<p>
You should see a green square, and no red.
</p>
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
style="display: none">
<defs>
<g id="square">
<rect width="100" height="100" fill="green" />
</g>
</defs>
<g id="test">
<use />
</g>
</svg>
<script>
onload = () => {
document.querySelector("use").setAttributeNS("http://www.w3.org/1999/xlink", "href", "#square");
document.querySelector("svg").style.display = "";
}
</script>

View file

@ -2,10 +2,10 @@ import sys
import os
import unittest
import json
from types import MethodType
from io import BytesIO
import pytest
from six import create_bound_method
wptserve = pytest.importorskip("wptserve")
from .base import TestUsingServer, TestUsingH2Server, doc_root
@ -19,13 +19,11 @@ def send_body_as_header(self):
self._headers_complete = True
class TestResponse(TestUsingServer):
@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2")
def test_head_without_body(self):
@wptserve.handlers.handler
def handler(request, response):
response.writer.end_headers = MethodType(send_body_as_header,
response.writer,
wptserve.response.ResponseWriter)
response.writer.end_headers = create_bound_method(send_body_as_header,
response.writer)
return [("X-Test", "TEST")], "body\r\n"
route = ("GET", "/test/test_head_without_body", handler)
@ -35,14 +33,12 @@ class TestResponse(TestUsingServer):
self.assertEqual("TEST", resp.info()['x-Test'])
self.assertEqual("", resp.info()['x-body'])
@pytest.mark.xfail(sys.version_info >= (3,), reason="wptserve only works on Py2")
def test_head_with_body(self):
@wptserve.handlers.handler
def handler(request, response):
response.send_body_for_head_request = True
response.writer.end_headers = MethodType(send_body_as_header,
response.writer,
wptserve.response.ResponseWriter)
response.writer.end_headers = create_bound_method(send_body_as_header,
response.writer)
return [("X-Test", "TEST")], "body\r\n"
route = ("GET", "/test/test_head_with_body", handler)