Skip to content

Commit

Permalink
move wpt for intrinsicsize to the right directory
Browse files Browse the repository at this point in the history
TBR: [email protected]
Bug: 874629
Change-Id: Ia5346b73344bf33dd1446591b85acf0d6a608e9b
Reviewed-on: https://chromium-review.googlesource.com/1220091
Commit-Queue: Luna Lu <[email protected]>
Reviewed-by: Luna Lu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#590435}
  • Loading branch information
loonybear authored and Commit Bot committed Sep 11, 2018
1 parent 8ee0167 commit 21b4181
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 87 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
'use strict';

const srcs = [
"/feature-policy/experimental-features/resources/image.svg",
"/feature-policy/experimental-features/resources/image.jpg",
"/feature-policy/experimental-features/resources/image.png",
"/images/green.svg",
"/images/green.png",
];

for (var src of srcs) {
Expand Down Expand Up @@ -90,7 +89,7 @@
assert_equals(img.naturalHeight, expected_intrinsic_height, 'naturalHeigh');
t.done();
}));
img.srcset = srcs[2] + ' 32w';
img.srcset = '/images/background.png 32w';
}, 'Test image (32 x 32) with sizes = 100 and srcset descriptor = 32w');

</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
'use strict';

const srcs = [
"/feature-policy/experimental-features/resources/image.svg",
"/feature-policy/experimental-features/resources/image.jpg",
"/feature-policy/experimental-features/resources/image.png",
"/images/green.svg",
"/images/green.png",
];

// Set new attribute, and wait til the media element is repainted.
Expand All @@ -19,7 +18,6 @@
});
}

// Test intrinsicSize attribute with image element.
for (var src of srcs) {
promise_test(async() => {
var img = document.createElement('IMG');
Expand Down Expand Up @@ -62,39 +60,7 @@
assert_equals(img.height, 800, 'height');
assert_equals(img.naturalWidth, 400, 'naturalWidth');
assert_equals(img.naturalHeight, 500, 'naturalHeight');
}, 'Test image with src=' + src);
}, 'Test intrinsicsize for html image element, src=' + src);
}

// Test intrinsicSize attribute with video element.
promise_test(async() => {
var video = document.createElement('video');
document.body.appendChild(video);
video.src = "/feature-policy/experimental-features/resources/video.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 video');
</script>
</body>
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Feature-Policy: unsized-media *

0 comments on commit 21b4181

Please sign in to comment.