blob: cd67f4e998aaefac319d5bde37ca6ff1d1732afa [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<script type="text/javascript">
description("Tests that we get the correct number of images when copying under different display resolutions.");
var pixelRatio = 1;
if (window.testRunner) {
testRunner.dumpAsText(true);
testRunner.waitUntilDone();
}
function doCopy()
{
document.execCommand("selectAll", true);
document.execCommand("copy");
}
function checkCount()
{
var imageCount = testRunner.imageCountInGeneralPasteboard();
if (imageCount == 4)
testPassed("Found all 4 images at " + pixelRatio + "x Resolution.");
else
testFailed("Only found " + imageCount + " images at " + pixelRatio + "x Resolution.");
}
function doTest()
{
doCopy();
checkCount();
if (pixelRatio < 3) {
pixelRatio = pixelRatio + 1;
testRunner.setBackingScaleFactor(pixelRatio, doTest);
} else {
setTimeout(function() { testRunner.notifyDone(); }, 0);
}
}
function runTests()
{
if (window.testRunner)
testRunner.setBackingScaleFactor(pixelRatio, doTest);
}
</script>
</head>
<body onLoad="runTests()">
<div id="images">
<p>Image 1</p>
<img src="http://127.0.0.1:8000/resources/img-srcset/image1-620x442.jpg">
<p>Image 2</p>
<img src="http://127.0.0.1:8000/resources/img-srcset/image2-1024x731.jpg"
srcset="http://127.0.0.1:8000/resources/img-srcset/image2-300x214.jpg 300w,
http://127.0.0.1:8000/resources/img-srcset/image2-1024x731.jpg 1024w,
http://127.0.0.1:8000/resources/img-srcset/image2-620x442.jpg 620w,
http://127.0.0.1:8000/resources/img-srcset/image2-840x600.jpg 840w,
http://127.0.0.1:8000/resources/img-srcset/image2-1400x1000.jpg 1400w"
sizes="(max-width: 1024px) 100vw, 1024px">
<p>Image 3</p>
<img src="http://127.0.0.1:8000/resources/img-srcset/image3-700x498.jpg"
srcset="http://127.0.0.1:8000/resources/img-srcset/image3-250x178.jpg 250w,
http://127.0.0.1:8000/resources/img-srcset/image3-700x498.jpg 700w,
http://127.0.0.1:8000/resources/img-srcset/image3-620x440.jpg 620w,
http://127.0.0.1:8000/resources/img-srcset/image3-615x438.jpg 615w,
http://127.0.0.1:8000/resources/img-srcset/image3-840x598.jpg 840w,
http://127.0.0.1:8000/resources/img-srcset/image3.jpg 1403w"
sizes="(max-width: 700px) 100vw, 700px">
<p>Image 4</p>
<img src="http://127.0.0.1:8000/resources/img-srcset/image4-1024x612.jpg"
srcset="http://127.0.0.1:8000/resources/img-srcset/image4-300x179.jpg 300w,
http://127.0.0.1:8000/resources/img-srcset/image4-1024x612.jpg 1024w,
http://127.0.0.1:8000/resources/img-srcset/image4-620x370.jpg 620w,
http://127.0.0.1:8000/resources/img-srcset/image4-840x502.jpg 840w,
http://127.0.0.1:8000/resources/img-srcset/image4-940x560.jpg 940w,
http://127.0.0.1:8000/resources/img-srcset/image4-768x459.jpg 768w"
sizes="(max-width: 1024px) 100vw, 1024px">
</div>
<div id="console"></div>
</body>
<script src="../../../resources/js-test-post.js"></script>
</html>