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> |