Update web-platform-tests to revision 632a3f59238036b6e24b28d47218ba9986ff4c62

This commit is contained in:
WPT Sync Bot 2018-09-12 21:47:12 -04:00
parent cd02ca6c19
commit fb838278a5
430 changed files with 15017 additions and 508 deletions

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<svg width=200 height=200>
<image href="/images/background.png" width="32" height="32"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" width="300" height="150"/>
</svg>
<svg width=400 height=400>
<image href="/images/background.png" width="300" height="150"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" width="300" height="150"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" height="50" width="100"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" width="100" height="100"/>
</svg>
</body>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="match" href="intrinsicsize-svg-image-ref.html">
<meta name="assert" content="test">
<body>
<svg width=200 height=200>
<image href="/images/background.png"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" intrinsicsize="300x150"/>
</svg>
<svg width=400 height=400>
<image href="/images/background.png" intrinsicsize="300x150"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" intrinsicsize="300x150" width="300"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" intrinsicsize="300x150" height="50"/>
</svg>
<svg width=200 height=200>
<image href="/images/background.png" intrinsicsize="300x150" width="100" height="100"/>
</svg>
</body>

View file

@ -0,0 +1,96 @@
<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
const srcs = [
"/images/green.svg",
"/images/green.png",
];
for (var src of srcs) {
async_test(t => {
var img = document.createElement('IMG');
img.intrinsicSize = '400 x 500';
var expected_intrinsic_width = 400;
var expected_intrinsic_height = 500;
var expected_width = expected_intrinsic_width;
var expected_height = expected_intrinsic_height;
document.body.appendChild(img);
img.addEventListener('load', t.step_func(() => {
assert_equals(img.width, expected_width, 'width');
assert_equals(img.height, expected_height, 'height');
assert_equals(img.naturalWidth, expected_intrinsic_width, 'naturalWidth');
assert_equals(img.naturalHeight, expected_intrinsic_height, 'naturalHeigh');
t.done();
}));
img.srcset = src + ' 3x';
}, 'Test image ' + src + ' with no specified sizes, width, or height');
async_test(t => {
var img = document.createElement('IMG');
img.intrinsicSize = '400 x 500';
img.width = '800'; /* 2x of intrinsic width */
var expected_intrinsic_width = 400;
var expected_intrinsic_height = 500;
var expected_width = expected_intrinsic_width * 2;
var expected_height = expected_intrinsic_height * 2;
document.body.appendChild(img);
img.addEventListener('load', t.step_func(() => {
assert_equals(img.width, expected_width, 'width');
assert_equals(img.height, expected_height, 'height');
assert_equals(img.naturalWidth, expected_intrinsic_width, 'naturalWidth');
assert_equals(img.naturalHeight, expected_intrinsic_height, 'naturalHeigh');
t.done();
}));
img.srcset = src + ' 3x';
}, 'Test image ' + src + ' with width = 800, no specified sizes, or height');
async_test(t => {
var img = document.createElement('IMG');
img.intrinsicSize = '400 x 500';
img.width = '800';
img.style = 'height:800px;';
var expected_intrinsic_width = 400;
var expected_intrinsic_height = 500;
var expected_width = 800;
var expected_height = 800;
document.body.appendChild(img);
img.addEventListener('load', t.step_func(() => {
assert_equals(img.width, expected_width, 'width');
assert_equals(img.height, expected_height, 'height');
assert_equals(img.naturalWidth, expected_intrinsic_width, 'naturalWidth');
assert_equals(img.naturalHeight, expected_intrinsic_height, 'naturalHeigh');
t.done();
}));
img.srcset = src + ' 3x';
}, 'Test image ' + src + ' with width = 800, height = 800, and no specified sizes');
}
async_test(t => {
var img = document.createElement('IMG');
img.intrinsicSize = '400 x 500';
img.sizes = '100px';
var expected_intrinsic_width = 100;
var expected_intrinsic_height = 125;
var expected_width = 100;
var expected_height = 125;
document.body.appendChild(img);
img.addEventListener('load', t.step_func(() => {
assert_equals(img.width, expected_width, 'width');
assert_equals(img.height, expected_height, 'height');
assert_equals(img.naturalWidth, expected_intrinsic_width, 'naturalWidth');
assert_equals(img.naturalHeight, expected_intrinsic_height, 'naturalHeigh');
t.done();
}));
img.srcset = '/images/background.png 32w';
}, 'Test image (32 x 32) with sizes = 100 and srcset descriptor = 32w');
</script>
</body>

View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
const srcs = [
"/images/green.svg",
"/images/green.png",
];
// Set new attribute, and wait til the media element is repainted.
function updateAttribute(e, attribute, value) {
return new Promise(resolve => {
requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
e.setAttribute(attribute, value);
});
}
for (var src of srcs) {
promise_test(async() => {
var img = document.createElement('IMG');
document.body.appendChild(img);
img.src = src;
await new Promise(resolve =>
img.addEventListener('load', () => resolve(), {once: true}));
await updateAttribute(img, 'intrinsicSize', '400 x 500');
assert_equals(img.width, 400, 'width');
assert_equals(img.height, 500, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
await updateAttribute(img, 'width', '800');
assert_equals(img.width, 800, 'width');
assert_equals(img.height, 1000, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
await updateAttribute(img, 'style', 'height:800px;');
assert_equals(img.width, 800, 'width');
assert_equals(img.height, 800, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
await updateAttribute(img, 'width', '');
assert_equals(img.width, 640, 'width');
assert_equals(img.height, 800, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
await updateAttribute(img, 'style', 'height:800px; writing-mode: vertical-rl;');
assert_equals(img.width, 640, 'width');
assert_equals(img.height, 800, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
await updateAttribute(img, 'style', 'height:800px; writing-mode: horizontal-tb;');
assert_equals(img.width, 640, 'width');
assert_equals(img.height, 800, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
}, 'Test intrinsicsize for html image element, src=' + src);
}
</script>
</body>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
promise_test(async() => {
var video = document.createElement('video');
document.body.appendChild(video);
video.src = "/images/pattern.ogv";
await new Promise(resolve =>
video.addEventListener('canplaythrough', () => resolve(), {once: true}));
video.intrinsicSize = '400 x 500';
assert_equals(video.getBoundingClientRect().width, 400, 'width');
assert_equals(video.getBoundingClientRect().height, 500, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.width = '800';
assert_equals(video.getBoundingClientRect().width, 800, 'width');
assert_equals(video.getBoundingClientRect().height, 1000, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.style = 'height:800px;';
assert_equals(video.getBoundingClientRect().width, 800, 'width');
assert_equals(video.getBoundingClientRect().height, 800, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
video.removeAttribute('width');
assert_equals(video.getBoundingClientRect().width, 640, 'width');
assert_equals(video.getBoundingClientRect().height, 800, 'height');
assert_equals(video.videoWidth, 400, 'naturalWidth');
assert_equals(video.videoHeight, 500, 'naturalHeight');
}, 'Test intrinsicsize for html video element');
</script>
</body>