|
| 1 | +<!doctype html> |
| 2 | +<meta charset=utf-8> |
| 3 | +<title>Subresources and fragment preservation</title> |
| 4 | +<script src=/resources/testharness.js></script> |
| 5 | +<script src=/resources/testharnessreport.js></script> |
| 6 | +<script src=/html/canvas/resources/canvas-tests.js></script> |
| 7 | +<div id=log></div> |
| 8 | +<!-- |
| 9 | + The source image is 50h x 100w and its color depends on the fragment. |
| 10 | +
|
| 11 | + This image is then drawn on a 50h x 100w transparent black canvas. |
| 12 | +--> |
| 13 | +<img data-desc="Control" |
| 14 | + src="/images/colors.svg#green"> |
| 15 | +<img data-desc="Redirect with the original URL containing a fragment" |
| 16 | + src="../api/resources/redirect.py?simple&location=/images/colors.svg#green"> |
| 17 | +<img data-desc="Redirect with the response Location header containing a fragment" |
| 18 | + src="../api/resources/redirect.py?simple&location=/images/colors.svg%23green"> |
| 19 | +<img data-desc="Redirect with both the original URL and response Location header containing a fragment" |
| 20 | + src="../api/resources/redirect.py?simple&location=/images/colors.svg%23green#red"> |
| 21 | +<canvas width=100 height=50></canvas> |
| 22 | +<script> |
| 23 | +setup({ explicit_done:true }); |
| 24 | +onload = () => { |
| 25 | + const canvas = document.querySelector("canvas"); |
| 26 | + const ctx = canvas.getContext("2d"); |
| 27 | + document.querySelectorAll("img").forEach(img => { |
| 28 | + test(t => { |
| 29 | + t.add_cleanup(() => { |
| 30 | + ctx.clearRect(0, 0, 100, 50); |
| 31 | + }); |
| 32 | + ctx.drawImage(img, 0, 0); |
| 33 | + // canvas, pixelX, pixelY, r, g, b, alpha, ?, ?, tolerance |
| 34 | + _assertPixelApprox(canvas, 40, 40, 0, 255, 0, 255, undefined, undefined, 4); |
| 35 | + }, img.dataset.desc); |
| 36 | + }); |
| 37 | + done(); |
| 38 | +}; |
| 39 | +</script> |
0 commit comments