Permalink
Browse files

Test for drawImage of an SVG image

  • Loading branch information...
1 parent 6933738 commit 95db95485c1a53ec6053cb1a87734f834dbdc29f @tagawa tagawa committed Feb 19, 2013
Showing with 37 additions and 0 deletions.
  1. +34 −0 canvas2d/drawing-images-to-the-canvas/2d.drawImage.svg.html
  2. +3 −0 images/green.svg
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<title>Canvas test: 2d.drawImage.animated.poster</title>
+<meta name="author" content="Daniel Davis">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../../common/canvas-tests.js"></script>
+<link rel="stylesheet" href="../../../common/canvas-tests.css">
+<body class="show_output">
+
+<h1><a href="index.2d.html">2d</a>.<a href="index.2d.drawImage.html">drawImage</a>.svg</h1>
+<p class="desc">drawImage() of an SVG image</p>
+
+<div class="refs">Spec references:
+<ul>
+<li><a href="../annotated-spec/canvas.html#testrefs.2d.drawImage.svg">2d.drawImage.svg</a>
+</ul>
+</div>
+
+<p class="output">Actual output:</p>
+<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
+<p class="output expectedtext">Expected output:<p><img src="../../../images/green-100x50.png" class="output expected" id="expected" alt="">
+<ul id="d"></ul>
+<script>
+var t = async_test("drawImage() of an SVG image");
+_addTest(function(canvas, ctx) {
+
+ctx.drawImage(document.getElementById('green.svg'), 0, 0);
+_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
+
+
+});
+</script>
+<img src="../../../images/green.svg" id="green.svg" class="resource">
+
View
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="100" height="50">
+ <rect fill="lime" width="100" height="50"/>
+</svg>

0 comments on commit 95db954

Please sign in to comment.