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

Unified Diff: LayoutTests/canvas/philip/tests/2d.text.draw.text.metrics.html

Issue 950773003: Improve 2D Canvas Text Metrics Test (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding missing endTest() statements Created 5 years, 9 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 | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/canvas/philip/tests/2d.text.draw.text.metrics.html
diff --git a/LayoutTests/canvas/philip/tests/2d.text.draw.text.metrics.html b/LayoutTests/canvas/philip/tests/2d.text.draw.text.metrics.html
index 4ddf0464923230305ee794b747ff13d95286ce4a..dfd5e00536438a388fa04ce5342dce17d3a38205 100644
--- a/LayoutTests/canvas/philip/tests/2d.text.draw.text.metrics.html
+++ b/LayoutTests/canvas/philip/tests/2d.text.draw.text.metrics.html
@@ -4,14 +4,13 @@
<link rel="stylesheet" href="../tests.css">
<style>
@font-face {
- font-family: CanvasTest;
- src: url("../fonts/CanvasTest.ttf");
+ font-family: Libertine;
+ src: url("../../../third_party/Libertine/LinLibertine_R.woff");
}
</style>
<body>
<p id="passtext">Pass</p>
<p id="failtext">Fail</p>
-<span style="font-family: CanvasTest; position: absolute; visibility: hidden">A</span>
<p class="output">These images should be identical:</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="green-100x50.png" class="output expected" id="expected" alt="">
@@ -56,11 +55,8 @@ function _printTextMetrics(ctx) {
_warn("Actual Bounding Box Descent (low): " + dl);
}
-_addTest(function(canvas, ctx) {
-ctx.font = '50px CanvasTest';
-deferTest();
-setTimeout(wrapFunction(function () {
+function measureMetrics(ctx) {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
@@ -88,9 +84,20 @@ setTimeout(wrapFunction(function () {
ctx.textBaseline="bottom";
_warn("Baseline: bottom");
_printTextMetrics(ctx);
-}), 500);
+ endTest();
+}
+function handleError() {
+ _warn("Unable to load required test font.");
+ endTest();
+}
+
+_addTest(function(canvas, ctx) {
+ ctx.font = '50px Libertine';
+ deferTest();
+ document.fonts.load(ctx.font)
+ .then(function() { measureMetrics(ctx) }, handleError);
});
</script>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698