Update web-platform-tests to revision 9fc797e6e5fb7d244dfb5b5125886c01f8cedf2b

This commit is contained in:
WPT Sync Bot 2019-02-05 21:00:19 -05:00
parent b7e9bab267
commit 6dda93c6e2
55 changed files with 646 additions and 128 deletions

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>'border-image-repeat' with 'space' and 'round'</title>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#border-image-repeat">
<link rel="match" href="reference/border-image-repeat-005-ref.html">
<style>
#target {
width: 255px;
height: 80px;
border: 10px solid red;
border-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><rect width='100' height='100' fill='green'/></svg>") 0 fill / 0px space round;
}
</style>
<p>There should be two green rectangles below:</p>
<div id="target"></div>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<title>Reference: 'border-image-repeat' with 'space' and 'round'</title>
<style>
.green {
width: 100px;
height: 100px;
background-color: green;
position: absolute;
}
</style>
<p>There should be two green rectangles below:</p>
<div style="position: relative">
<div class="green" style="left: 25px"></div>
<div class="green" style="left: 150px"></div>
</div>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<title>Test for font-display-late-swap feature policy</title>
<title>Test for font-display-late-swap feature policy behavior when set to reporting</title>
<style>
.ahem {
font-family: 'Ahem';

View file

@ -1,8 +1,8 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>Test for font-display-late-swap feature policy</title>
<title>Test for font-display-late-swap feature policy behavior when set to reporting</title>
<link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md">
<link rel="match" href="font-display-feature-policy.tentative-ref.html">
<link rel="match" href="font-display-feature-policy-01.tentative-ref.html">
<style>
</style>
<p>Tests if font-display is set to optional for each option except for when it is set to fallback</p>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<title>Test for font-display-late-swap feature policy behavior when set to report-only</title>
<style>
.ahem {
font-family: 'Ahem';
}
.arial {
font-family: 'Arial';
}
</style>
<p>None of the font-display values should be changed</p>
<table id="container">
<tr>
<th>not-set</th>
<th>auto</th>
<th>block</th>
<th>swap</th>
<th>fallback</th>
<th>optional</th>
</tr>
<tr>
<td class="ahem">a</td>
<td class="ahem">a</td>
<td class="ahem">a</td>
<td class="ahem">a</td>
<td class="ahem">a</td>
<td class="arial">a</td>
</tr>
</table>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html class="reftest-wait">
<title>Test for font-display-late-swap feature policy behavior when set to report-only</title>
<link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md">
<link rel="match" href="font-display-feature-policy-02.tentative-ref.html">
<style>
</style>
<p>None of the font-display values should be changed</p>
<table id="container">
<tr>
<th>not-set</th>
<th>auto</th>
<th>block</th>
<th>swap</th>
<th>fallback</th>
<th>optional</th>
</tr>
</table>
<script>
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
const table = document.getElementById('container');
function makeFontFaceDeclaration(family, display) {
url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
}
window.onload = () => {
let tr = document.createElement('tr');
for (let display of fontDisplayValues) {
const family = display + '-face';
const rule = makeFontFaceDeclaration(family, display);
document.styleSheets[0].insertRule(rule, 0);
let td = document.createElement('td');
td.textContent = 'a';
td.style.fontFamily = family + ', Arial';
tr.appendChild(td);
}
table.appendChild(tr);
const timeoutMilliSec = 1500; // After the font is loaded
setTimeout(() => {
document.documentElement.classList.remove("reftest-wait");
}, timeoutMilliSec);
}
</script>
</html>

View file

@ -0,0 +1 @@
Feature-Policy-Report-Only: font-display-late-swap 'none';

View file

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<title>Test for font-display-late-swap feature policy set to report-only</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#reporting">
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<style>
</style>
</head>
<body>
<p>
Tests if the correct number of violation reports are generated and each report corresponds to this feature.
4 reports should be created out of the 6 options below (reports for all except for 'fallback' and 'optional').
</p>
<table id="container">
<tr>
<th>not-set</th>
<th>auto</th>
<th>block</th>
<th>swap</th>
<th>fallback</th>
<th>optional</th>
</tr>
</table>
<script>
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
const table = document.getElementById('container');
function makeFontFaceDeclaration(family, display) {
url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
}
window.onload = () => {
let tr = document.createElement('tr');
for (let display of fontDisplayValues) {
const family = display + '-face';
const rule = makeFontFaceDeclaration(family, display);
document.styleSheets[0].insertRule(rule, 0);
let td = document.createElement('td');
td.textContent = 'a';
td.style.fontFamily = family + ', Arial';
tr.appendChild(td);
}
table.appendChild(tr);
}
let reportCounter = 4;
let t = async_test('font-display-late-swap Report Format');
let check_report_format = (reports, observer) => {
reportCounter -= reports.length;
for (let report of reports) {
assert_equals(report.type, 'feature-policy-violation');
assert_equals(report.url, document.location.href, 'Report URL');
assert_equals(report.body.featureId, 'font-display-late-swap');
assert_equals(report.body.disposition, 'report');
assert_true('sourceFile' in report.body);
assert_true('lineNumber' in report.body);
assert_true('columnNumber' in report.body);
}
// Test is done when we have exactly 4 reports for the following
// font-display values: not set, 'auto', 'block', 'swap'
if (reportCounter == 0) t.done();
};
new ReportingObserver(t.step_func(check_report_format),
{types: ['feature-policy-violation'], buffered: true}).observe();
</script>
</body>
</html>

View file

@ -0,0 +1 @@
Feature-Policy-Report-Only: font-display-late-swap 'none';

View file

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<title>Test for font-display-late-swap feature policy set to reporting</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#reporting">
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<style>
</style>
</head>
<body>
<p>
Tests if the correct number of violation reports are generated and each report corresponds to this feature.
4 reports should be created out of the 6 options below (reports for all except for 'fallback' and 'optional').
</p>
<table id="container">
<tr>
<th>not-set</th>
<th>auto</th>
<th>block</th>
<th>swap</th>
<th>fallback</th>
<th>optional</th>
</tr>
</table>
<script>
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
const table = document.getElementById('container');
function makeFontFaceDeclaration(family, display) {
url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
}
window.onload = () => {
let tr = document.createElement('tr');
for (let display of fontDisplayValues) {
const family = display + '-face';
const rule = makeFontFaceDeclaration(family, display);
document.styleSheets[0].insertRule(rule, 0);
let td = document.createElement('td');
td.textContent = 'a';
td.style.fontFamily = family + ', Arial';
tr.appendChild(td);
}
table.appendChild(tr);
}
let reportCounter = 4;
let t = async_test('font-display-late-swap Report Format');
let check_report_format = (reports, observer) => {
reportCounter -= reports.length;
for (let report of reports) {
assert_equals(report.type, 'feature-policy-violation');
assert_equals(report.url, document.location.href, 'Report URL');
assert_equals(report.body.featureId, 'font-display-late-swap');
assert_equals(report.body.disposition, 'enforce');
assert_true('sourceFile' in report.body);
assert_true('lineNumber' in report.body);
assert_true('columnNumber' in report.body);
}
// Test is done when we have exactly 4 reports for the following
// font-display values: not set, 'auto', 'block', 'swap'
if (reportCounter == 0) t.done();
};
new ReportingObserver(t.step_func(check_report_format),
{types: ['feature-policy-violation'], buffered: true}).observe();
</script>
</body>
</html>

View file

@ -0,0 +1 @@
Feature-Policy: font-display-late-swap 'none';

View file

@ -1,3 +1,4 @@
from __future__ import print_function
import os
import textwrap
@ -474,13 +475,13 @@ def makeJavascriptData():
# build fonts
print "Making lookup type 1 font..."
print("Making lookup type 1 font...")
makeLookup1()
print "Making lookup type 3 font..."
print("Making lookup type 3 font...")
makeLookup3()
# output javascript data
print "Making javascript data file..."
print("Making javascript data file...")
makeJavascriptData()

View file

@ -11,6 +11,7 @@
# [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
#
from __future__ import print_function
import sys
import os
import glob
@ -24,11 +25,11 @@ from apiclient import apiclient
def runTests(testFileSearch):
for testFilePath in glob.glob(testFileSearch):
print 'Running tests from: ' + testFilePath
print('Running tests from: ' + testFilePath)
with open(testFilePath) as testFile:
testData = json.load(testFile, object_pairs_hook = collections.OrderedDict)
for testSetName in testData:
print testSetName + ':'
print(testSetName + ':')
testSet = testData[testSetName]
vars = testSet['variables']
for test in testSet['testcases']:
@ -37,31 +38,31 @@ def runTests(testFileSearch):
template = uritemplate.URITemplate(test[0])
except Exception as e:
if (expectedResult):
print '* FAIL: "' + test[0] + '" got: None, expected "' + expectedResult + '"'
print('* FAIL: "' + test[0] + '" got: None, expected "' + expectedResult + '"')
else:
print ' PASS: "' + test[0] + '" == None'
print(' PASS: "' + test[0] + '" == None')
continue
result = template.expand(**vars)
if (isinstance(expectedResult, basestring)):
if (expectedResult != result):
print '* FAIL: "' + test[0] + '" got: "' + unicode(result) + '", expected "' + expectedResult + '"'
print('* FAIL: "' + test[0] + '" got: "' + unicode(result) + '", expected "' + expectedResult + '"')
continue
elif (isinstance(expectedResult, list)):
for possibleResult in expectedResult:
if (possibleResult == result):
break
else:
print '* FAIL: "' + test[0] + '" got: "' + unicode(result) + '", expected:'
print " or\n".join([' "' + possibleResult + '"' for possibleResult in expectedResult])
print('* FAIL: "' + test[0] + '" got: "' + unicode(result) + '", expected:')
print(" or\n".join([' "' + possibleResult + '"' for possibleResult in expectedResult]))
continue
elif (not expectedResult):
if (result):
print '* FAIL "' + test[0] + '" got: "' + unicode(result) + '", expected None'
print('* FAIL "' + test[0] + '" got: "' + unicode(result) + '", expected None')
continue
else:
print '** Unknown expected result type: ' + repr(expectedResult)
print ' PASS: "' + test[0] + '" == "' + result + '"'
print('** Unknown expected result type: ' + repr(expectedResult))
print(' PASS: "' + test[0] + '" == "' + result + '"')
def debugHook(type, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
@ -72,7 +73,7 @@ def debugHook(type, value, tb):
import traceback, pdb
# we are NOT in interactive mode, print the exception...
traceback.print_exception(type, value, tb)
print
print()
# ...then start the debugger in post-mortem mode.
pdb.pm()
@ -88,18 +89,18 @@ if __name__ == "__main__": # called from the command line
github = apiclient.APIClient('https://api.github.com/', version = 'vnd.github.beta')
print github.get('user_url', user = 'plinss').data
print(github.get('user_url', user = 'plinss').data)
# shepherd = apiclient.APIClient('https://api.csswg.org/shepherd/', version = 'vnd.csswg.shepherd.v1')
shepherd = apiclient.APIClient('https://test.linss.com/shepherd/api', version = 'vnd.csswg.shepherd.v1')
print shepherd.resourceNames
print(shepherd.resourceNames)
specs = shepherd.resource('specifications')
print specs.variables
print(specs.variables)
# print specs.hints.docs
print shepherd.get('specifications', spec = 'compositing-1', anchors = False).data
print(shepherd.get('specifications', spec = 'compositing-1', anchors = False).data)
suites = shepherd.resource('test_suites')
print suites.variables
print shepherd.get('test_suites', spec = 'css-shapes-1').data
print(suites.variables)
print(shepherd.get('test_suites', spec = 'css-shapes-1').data)

View file

@ -3,6 +3,7 @@
# Initial code by fantasai, joint copyright 2010 W3C and Microsoft
# Licensed under BSD 3-Clause: <http://www.w3.org/Consortium/Legal/2008/03-bsd-license>
from __future__ import print_function
from os.path import basename, exists, join
import os
import filecmp
@ -965,7 +966,7 @@ class XMLSource(FileSource):
if ((not self.metadata) and self.tree and (not self.errors)):
self.extractMetadata(self.tree)
except etree.ParseError as e:
print "PARSE ERROR: " + self.sourcepath
print("PARSE ERROR: " + self.sourcepath)
self.cacheAsParseError(self.sourcepath, e)
e.W3CTestLibErrorLocation = self.sourcepath
self.errors = [str(e)]
@ -1375,7 +1376,7 @@ class HTMLSource(XMLSource):
if ((not self.metadata) and self.tree and (not self.errors)):
self.extractMetadata(self.tree)
except Exception as e:
print "PARSE ERROR: " + self.sourcepath
print("PARSE ERROR: " + self.sourcepath)
e.W3CTestLibErrorLocation = self.sourcepath
self.errors = [str(e)]
self.encoding = 'utf-8'