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

Unified Diff: third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas.html

Issue 1331533002: [poc] curve-filter Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix CanvasRenderingContext2D::createPattern crash for #40 Created 4 years, 11 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
Index: third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas.html
diff --git a/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas.html b/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas.html
new file mode 100644
index 0000000000000000000000000000000000000000..840d56231257b0dad20ff1d800b7113850ff0eaa
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<script src="../../resources/run-after-layout-and-paint.js"></script>
+
+<style>
+ canvas, img { margin: 5px; width: 380px }
+</style>
+
+<body style="overflow: hidden">
+ <!-- The _blue_ sector of the <img> image should be at 12 o'clock. -->
+ <img>
+ <!-- The red sector of the <canvas> image should be at 12 o'clock. -->
+ <canvas></canvas>
+</body>
+
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsTextWithPixelResults();
+ testRunner.waitUntilDone();
+}
+
+window.onload = function() {
+ if (window.internals)
+ internals.settings.setImageColorProfilesEnabled(true);
+
+ var image = document.querySelector('img');
+ image.onload = function() {
+ runAfterLayoutAndPaint(window.testRunner ? changeColorProfile : profileChanged);
+ };
+
+ image.src = 'resources/red-at-12-oclock-with-color-profile.jpg';
+};
+
+function changeColorProfile() {
+ window.testRunner.setColorProfile('sRGB', profileChanged);
+}
+
+function profileChanged() {
+ setTimeout(drawImageToCanvas, 0);
+}
+
+function drawImageToCanvas() {
+ var canvas = document.querySelector('canvas');
+ canvas.getContext('2d').clearRect(0, 0, canvas.width = 380, canvas.height = 380);
+
+ var image = document.querySelector('img');
+ canvas.getContext('2d').drawImage(image, 0, 0, canvas.width, canvas.height);
+
+ if (window.testRunner)
+ window.testRunner.setColorProfile('whacked', done);
+}
+
+function done() {
+ if (window.testRunner)
+ setTimeout(function() { window.testRunner.notifyDone() }, 0);
+}
+</script>
+</html>

Powered by Google App Engine
This is Rietveld 408576698