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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-text-ideographic-space.html

Issue 2695963004: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Fixing canvas-text-ideographic-space.html to pass on Mac trybots Created 3 years, 10 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/canvas/canvas-text-ideographic-space.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-text-ideographic-space.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-text-ideographic-space.html
index 5982e026674f8fd20a8b02f81502156ab1a66992..97c0e5dad154b74284a06723e482b2187a31a6c4 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-text-ideographic-space.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-text-ideographic-space.html
@@ -1,25 +1,40 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charcode="utf-16">
- <script src="../../resources/js-test.js"></script>
- <style>
-
+<meta charcode="utf-16">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
span {
padding : 0px;
font-size : 12px;
font-family : Arial;
display : inline;
}
-
- </style>
-</head>
+</style>
<body>
- <div><span>a&#x3000;b&#x3000;c</span></div>
- <div><canvas></canvas></div>
- <script>
+<div><span>a&#x3000;b&#x3000;c</span></div>
+<div><canvas></canvas></div>
+
+<script>
+var PIXEL_RATIO = (function () {
+ var ctx = document.createElement("canvas").getContext("2d"),
+ dpr = window.devicePixelRatio || 1,
+ bsr = ctx.webkitBackingStorePixelRatio ||
+ ctx.mozBackingStorePixelRatio ||
+ ctx.msBackingStorePixelRatio ||
+ ctx.oBackingStorePixelRatio ||
+ ctx.backingStorePixelRatio || 1;
+
+ return dpr / bsr;
+})();
+
+test(function(t) {
var canvas = document.querySelector("canvas");
+ canvas.width = 300 * PIXEL_RATIO;
+ canvas.height = 150 * PIXEL_RATIO;
+ canvas.style.width = 300 + "px";
+ canvas.style.height = 150 + "px";
+ canvas.getContext("2d").setTransform(PIXEL_RATIO, 0, 0, PIXEL_RATIO, 0, 0);
+
var context = canvas.getContext("2d");
var span = document.querySelector("span");
@@ -29,8 +44,8 @@
spanWidth = span.offsetWidth;
canvasWidth = context.measureText(abc).width;
- shouldBeTrue("spanWidth == canvasWidth");
-
- </script>
+ assert_approx_equals(spanWidth, canvasWidth, 0.999);
+}, 'Test canvas text ideographic space.');
+</script>
</body>
-</html>
+

Powered by Google App Engine
This is Rietveld 408576698