Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg.html

Issue 1890613002: Support createImageBitmap from a SVG image (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg.html
new file mode 100644
index 0000000000000000000000000000000000000000..f494a779515ded894090c2d191553675ab682e49
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+
+description("Test createImageBitmap from a SVG image.");
+window.jsTestIsAsync = true;
+
+function shouldBeBlue(x, y) {
+ d = ctx.getImageData(x, y, 1, 1).data;
+ shouldBeEqualToNumber("d[0]", 0);
+ shouldBeEqualToNumber("d[1]", 0);
+ shouldBeEqualToNumber("d[2]", 255);
+ shouldBeEqualToNumber("d[3]", 255);
+}
+
+var canvas = document.createElement("canvas");
+canvas.setAttribute("width", "200");
+canvas.setAttribute("height", "200");
+var ctx = canvas.getContext("2d");
+var bitmap;
+
+var image = new Image();
+image.onload = function() {
+ createImageBitmap(image).then(function(imageBitmap) {
+ bitmap = imageBitmap;
+ shouldBe("bitmap.width", "200");
+ shouldBe("bitmap.height", "200");
+ ctx.clearRect(0, 0, 200, 200);
+ ctx.drawImage(imageBitmap, 0, 0);
+ shouldBeBlue(0, 0);
+ shouldBeBlue(0, 199);
+ shouldBeBlue(199, 0);
+ shouldBeBlue(199, 199);
+ finishJSTest();
+ }, function (e) {
+ testFailed("createImageBitmap promise rejected: " + e);
+ finishJSTest();
+ });
+}
+image.src = '../../svg/as-image/resources/200x200-blue-rect.svg';
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698