Bug 1533983 [wpt PR 15685] - HTML: escape CR character with 
 in canvas test, a=testonly

Automatic update from web-platform-tests
HTML: escape CR character with 
 in canvas test

See https://github.com/web-platform-tests/wpt/pull/1599

--

wpt-commits: 48f22602a7c347fe2316a6769866b7871232f0ab
wpt-pr: 15685
This commit is contained in:
Simon Pieters 2019-03-26 13:53:23 +00:00 коммит произвёл James Graham
Родитель a4d4c17713
Коммит 855f71dbb5
3 изменённых файлов: 12 добавлений и 10 удалений

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

@ -198,7 +198,7 @@
("empty", "", None),
("onlyspace", " ", None),
("space", " 100", 100),
("whitespace", "\n\t\f100", 100),
("whitespace", "\r\n\t\f100", 100),
("plus", "+100", 100),
("minus", "-100", None),
("octal", "0100", 100),
@ -235,11 +235,13 @@
for name, string, exp in cases:
code = ""
code, testing, expected = gen(name, string, exp, code)
# We need to replace \r with 
 because \r\n gets converted to \n in the HTML parser.
htmlString = string.replace('\r', '
')
tests.append( {
"name": "size.attributes.parse.%s" % name,
"desc": "Parsing of non-negative integers",
"testing": testing,
"canvas": 'width="%s" height="%s"' % (string, string),
"canvas": 'width="%s" height="%s"' % (htmlString, htmlString),
"code": code,
"expected": expected
} )

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

@ -12,8 +12,8 @@
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="
100" height="
<canvas id="c" class="output" width="&#xD;
100" height="&#xD;
100"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.whitespace.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
@ -24,8 +24,8 @@ _addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '\n\t\x0c100', "canvas.getAttribute('width')", "'\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('height'), '\n\t\x0c100', "canvas.getAttribute('height')", "'\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('width'), '\r\n\t\x0c100', "canvas.getAttribute('width')", "'\\r\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('height'), '\r\n\t\x0c100', "canvas.getAttribute('height')", "'\\r\\n\\t\\x0c100'");
});

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

@ -19,13 +19,13 @@
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '\n\t\x0c100');
canvas.setAttribute('height', '\n\t\x0c100');
canvas.setAttribute('width', '\r\n\t\x0c100');
canvas.setAttribute('height', '\r\n\t\x0c100');
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '\n\t\x0c100', "canvas.getAttribute('width')", "'\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('height'), '\n\t\x0c100', "canvas.getAttribute('height')", "'\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('width'), '\r\n\t\x0c100', "canvas.getAttribute('width')", "'\\r\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('height'), '\r\n\t\x0c100', "canvas.getAttribute('height')", "'\\r\\n\\t\\x0c100'");
});