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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html

Issue 2281873002: Convert LayoutTests/fast/canvas/2d tests to testharness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/2d.text.draw.fill.maxWidth.veryLarge-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/2d.text.draw.fill.maxWidth.veryLarge.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html b/third_party/WebKit/LayoutTests/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html
index e2a5812ade8b95b52e9526201cac80ca7ad3cde6..53a4b60b2502b94e8cd180df5074562ca75d10f2 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge.html
@@ -1,63 +1,32 @@
<!DOCTYPE html>
-<head>
+<title>Test that color gets applied properly with canvas2d text drawing when filled with large maxwidth</title>
fs 2016/08/26 11:05:29 (Note: This test strikes me as a bit odd - "200" i
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<style>
@font-face {
font-family: Ahem;
src: url('../../resources/Ahem.ttf');
}
</style>
-</head>
-<body>
-<p>On success, there should only be a green rectangle.</p>
-<canvas id="c" class="output" width="100" height="100"><p class="fallback">FAIL (fallback content)</p></canvas>
-<div id="console"></div>
-
+<canvas width="100" height="100"></canvas>
<script>
-function drawCanvas(ctx) {
- ctx.fillStyle = '#0f0';
- ctx.fillRect(0,0,100,100);
- ctx.fillStyle = '#f00';
- ctx.fillText("X", -100, 100, 200);
-}
-
-function doDeferredTest() {
- drawCanvas(ctx);
-
- // Check that the letter rendered appropriately
- var renderedCorrectly = true;
-
- // Check that there is only a green rectangle
- var imageData = ctx.getImageData(50,50,1,1);
- if (imageData.data[0] != 0) renderedCorrectly = false;
- if (imageData.data[1] != 255) renderedCorrectly = false;
- if (imageData.data[2] != 0) renderedCorrectly = false;
- if (imageData.data[3] != 255) renderedCorrectly = false;
-
- if (renderedCorrectly)
- document.getElementById("console").innerHTML = "TEST PASSED";
- else
- document.getElementById("console").innerHTML = "TEST FAILED";
-
- if (window.testRunner)
- testRunner.notifyDone();
-}
-
-if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
-}
-
-var canvas = document.getElementById('c');
-var ctx = canvas.getContext("2d");
-ctx.font = "100px Ahem";
-
-// Kick off loading of the font
-ctx.fillText(" ", 0, 0);
-
-// Wait for the font to load, then run
-setTimeout(function() {
- doDeferredTest();
-}, 50);
+async_test(function(t) {
+ var canvas = document.querySelector('canvas');
+ var ctx = canvas.getContext("2d");
+ ctx.font = "100px Ahem";
+ // Kick off loading of the font.
+ ctx.fillText(" ", 0, 0);
+ // Wait for the font to load, then run.
+ document.fonts.onloadingdone = t.step_func_done(function() {
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.fillStyle = '#f00';
+ ctx.fillText("X", -100, 100, 200);
+ var imageData = ctx.getImageData(50, 50, 1, 1);
+ assert_equals(imageData.data[0], 0, "red");
+ assert_equals(imageData.data[1], 255, "green");
+ assert_equals(imageData.data[2], 0, "blue");
+ assert_equals(imageData.data[3], 255, "alpha");
+ });
+});
</script>
-</body>
-</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/2d.text.draw.fill.maxWidth.veryLarge-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698