Update web-platform-tests to revision 8da19eeb64e1dbcc32cabc2961a44e15635d116f

This commit is contained in:
WPT Sync Bot 2019-07-04 10:26:17 +00:00
parent b32bff3b97
commit 120d9aa5dc
298 changed files with 9286 additions and 3047 deletions

View file

@ -57,6 +57,10 @@ for entry in root:
# There is no "isolated" mathvariant.
del mathvariantTransforms["isolated"]
# Automatic mathvariant uses the same transform as italic.
# It is handled specially (see below).
mathvariantTransforms["auto"] = mathvariantTransforms["italic"]
# Create a WOFF font for each mathvariant.
for mathvariant in mathvariantTransforms:
font = mathfont.create("mathvariant-%s" % mathvariant)
@ -67,29 +71,49 @@ for mathvariant in mathvariantTransforms:
mathfont.createGlyphFromValue(font, transformedChar)
mathfont.save(font)
# Create a test font for each mathvariant.
# Create a MathML and CSS test for each mathvariant.
for mathvariant in mathvariantTransforms:
print("Generating test for %s..." % mathvariant, end="")
print("Generating tests for %s..." % mathvariant, end="")
reftest = open("../relations/css-styling/mathvariant-%s.html" % mathvariant, "w")
reftestReference = open("../relations/css-styling/mathvariant-%s-ref.html" % mathvariant, "w")
CSSreftest = open("../../css/css-text/text-transform/math/text-transform-math-%s-001.tentative.html" % mathvariant, "w")
CSSreftestReference = open("../../css/css-text/text-transform/math/text-transform-math-%s-001.tentative-ref.html" % mathvariant, "w")
source = '\
<!DOCTYPE html>\n\
<html>\n\
<head>\n\
<meta charset="utf-8"/>\n\
<title>mathvariant %s</title>\n'
reftest.write(source % mathvariant)
reftestReference.write(source % ("%s (reference)" % mathvariant))
<title>%s</title>\n'
reftest.write(source % ("mathvariant %s" % mathvariant))
reftestReference.write(source % ("mathvariant %s (reference)" % mathvariant))
CSSreftest.write(source % ("text-transform math-%s" % mathvariant))
CSSreftestReference.write(source % ("text-transform math-%s (reference)" % mathvariant))
if mathvariant == "auto":
mathAssert = "Verify that a single-char <mi> is equivalent to an <mi> with the transformed italic unicode character."
else:
mathAssert = "Verify that a single-char <mtext> with a %s mathvariant is equivalent to an <mtext> with the transformed unicode character." % mathvariant
source ='\
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#cssproperties"/>\n\
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">\n\
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-mathvariant-attribute">\n\
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#new-text-transform-values">\n\
<link rel="match" href="mathvariant-%s-ref.html"/>\n\
<meta name="assert" content="Verify that a single-char <mtext> with a %s mathvariant is equivalent to an <mtext> with the transformed unicode character.">\n'
reftest.write(source % (mathvariant, mathvariant))
<meta name="assert" content="%s">\n'
reftest.write(source % (mathvariant, mathAssert))
source = '\
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/3745"/>\n\
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#new-text-transform-values">\n\
<link rel="match" href="text-transform-math-%s-001.tentative-ref.html"/>\n\
<meta name="assert" content="Verify that a character with \'text-transform: math-%s\' renders the same as the transformed unicode character.">\n'
CSSreftest.write(source % (mathvariant, mathvariant))
if mathvariant == "auto":
WOFFfont = "mathvariant-italic.woff"
else:
WOFFfont = "mathvariant-%s.woff" % mathvariant
source = '\
<style>\n\
@font-face {\n\
font-family: TestFont;\n\
src: url("/fonts/math/mathvariant-%s.woff");\n\
src: url("/fonts/math/%s");\n\
}\n\
body > span {\n\
padding: 10px;\n\
@ -98,30 +122,48 @@ for mathvariant in mathvariantTransforms:
font-family: monospace;\n\
font-size: 10px;\n\
}\n\
math {\n\
.testfont {\n\
font-family: TestFont;\n\
font-size: 10px;\n\
}\n\
</style>\n\
<body>\n\
<!-- Generated by mathml/tools/mathvariant.py; DO NOT EDIT. -->\n\
<p>Test passes if all the equalities below are true.</p>\n' % mathvariant
<p>Test passes if all the equalities below are true.</p>\n' % WOFFfont
reftest.write(source)
reftestReference.write(source)
CSSreftest.write(source)
CSSreftestReference.write(source)
charIndex = 0
for baseChar in mathvariantTransforms[mathvariant]:
transformedChar = mathvariantTransforms[mathvariant][baseChar]
reftest.write(' <span><math><mtext mathvariant="%s">&#x%0X;</mtext></math>=<span>%05X</span></span>' % (mathvariant, baseChar, transformedChar))
reftestReference.write(' <span><math><mtext>&#x%0X;</mtext></math>=<span>%05X</span></span>' % (transformedChar, transformedChar))
if mathvariant == "auto":
tokenTag = '<mi>&#x%0X;</mi>' % baseChar
tokenTagRef = '<mi>&#x%0X;</mi>' % transformedChar
else:
tokenTag = '<mtext mathvariant="%s">&#x%0X;</mtext>' % (mathvariant, baseChar)
tokenTagRef = '<mtext>&#x%0X;</mtext>' % transformedChar
reftest.write(' <span><math class="testfont">%s</math>=<span>%05X</span></span>' % (tokenTag, transformedChar))
reftestReference.write(' <span><math class="testfont">%s</math>=<span>%05X</span></span>' % (tokenTagRef, transformedChar))
CSSreftest.write(' <span><span class="testfont" style="text-transform: math-%s">&#x%0X;</span>=<span>%05X</span></span>' % (mathvariant, baseChar, transformedChar))
CSSreftestReference.write(' <span><span class="testfont">&#x%0X;</span>=<span>%05X</span></span>' % (transformedChar, transformedChar))
charIndex += 1
if charIndex % 10 == 0:
reftest.write('<br/>')
reftestReference.write('<br/>')
CSSreftest.write('<br/>')
CSSreftestReference.write('<br/>')
reftest.write('\n')
reftestReference.write('\n')
CSSreftest.write('\n')
CSSreftestReference.write('\n')
source = '</body>\n</html>\n'
reftest.write(source)
reftestReference.write(source)
CSSreftest.write(source)
CSSreftestReference.write(source)
reftest.close()
reftestReference.close()
CSSreftest.close()
CSSreftestReference.close()
print(" done.")