Title: [140858] trunk/LayoutTests
Revision
140858
Author
[email protected]
Date
2013-01-25 12:19:46 -0800 (Fri, 25 Jan 2013)

Log Message

Change svg/text/text-rect-precision.html to pass on non-subpixel platforms and add results
https://bugs.webkit.org/show_bug.cgi?id=107972

Reviewed by Levi Weintraub.

* platform/chromium-linux/svg/text/text-rect-precision-expected.txt: Removed.
* platform/chromium-mac/svg/text/text-rect-precision-expected.txt: Removed.
* svg/text/text-rect-precision.html:
* svg/text/text-rect-precision-expected.txt: Added

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140857 => 140858)


--- trunk/LayoutTests/ChangeLog	2013-01-25 20:18:58 UTC (rev 140857)
+++ trunk/LayoutTests/ChangeLog	2013-01-25 20:19:46 UTC (rev 140858)
@@ -1,3 +1,15 @@
+2013-01-25  Emil A Eklund  <[email protected]>
+
+        Change svg/text/text-rect-precision.html to pass on non-subpixel platforms and add results
+        https://bugs.webkit.org/show_bug.cgi?id=107972
+
+        Reviewed by Levi Weintraub.
+
+        * platform/chromium-linux/svg/text/text-rect-precision-expected.txt: Removed.
+        * platform/chromium-mac/svg/text/text-rect-precision-expected.txt: Removed.
+        * svg/text/text-rect-precision.html:
+        * svg/text/text-rect-precision-expected.txt: Added
+
 2013-01-25  Elliott Sprehn  <[email protected]>
 
         Consider all ancestors not just parentElement when disconnecting frames

Deleted: trunk/LayoutTests/platform/chromium-linux/svg/text/text-rect-precision-expected.txt (140857 => 140858)


--- trunk/LayoutTests/platform/chromium-linux/svg/text/text-rect-precision-expected.txt	2013-01-25 20:18:58 UTC (rev 140857)
+++ trunk/LayoutTests/platform/chromium-linux/svg/text/text-rect-precision-expected.txt	2013-01-25 20:19:46 UTC (rev 140858)
@@ -1,3 +0,0 @@
-PASS Width of text element is the sum of the width of all characters.
-Sphinx of black quartz, judge my vow.
-.

Deleted: trunk/LayoutTests/platform/chromium-mac/svg/text/text-rect-precision-expected.txt (140857 => 140858)


--- trunk/LayoutTests/platform/chromium-mac/svg/text/text-rect-precision-expected.txt	2013-01-25 20:18:58 UTC (rev 140857)
+++ trunk/LayoutTests/platform/chromium-mac/svg/text/text-rect-precision-expected.txt	2013-01-25 20:19:46 UTC (rev 140858)
@@ -1,3 +0,0 @@
-PASS Width of text element is 391, expected 393
-Sphinx of black quartz, judge my vow.
-.

Copied: trunk/LayoutTests/svg/text/text-rect-precision-expected.txt (from rev 140856, trunk/LayoutTests/platform/chromium-linux/svg/text/text-rect-precision-expected.txt) (0 => 140858)


--- trunk/LayoutTests/svg/text/text-rect-precision-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/text/text-rect-precision-expected.txt	2013-01-25 20:19:46 UTC (rev 140858)
@@ -0,0 +1,3 @@
+PASS Width of text element is the sum of the width of all characters.
+Sphinx of black quartz, judge my vow.
+.

Modified: trunk/LayoutTests/svg/text/text-rect-precision.html (140857 => 140858)


--- trunk/LayoutTests/svg/text/text-rect-precision.html	2013-01-25 20:18:58 UTC (rev 140857)
+++ trunk/LayoutTests/svg/text/text-rect-precision.html	2013-01-25 20:19:46 UTC (rev 140858)
@@ -13,6 +13,8 @@
     </svg>
 <script>
     
+    var hasSubpixelPrecision = false;
+    
     function measureText(testElement)
     {
         var measureElement = document.getElementById('measure');
@@ -28,6 +30,7 @@
                 measureElement.firstChild.nodeValue = c;
                 w = measureElement.getBoundingClientRect().width;
                 characterWidths[c] = w;
+                hasSubpixelPrecision = hasSubpixelPrecision || w.toFixed(2) != Math.round(w);
             }
             width += w;
         }
@@ -37,10 +40,11 @@
     var el = document.getElementById('test');
     var elementWidth = el.getBoundingClientRect().width;
     var textWidth = measureText(el);
-    if (Math.abs(elementWidth - textWidth) <= 0.1)
+    var tolerance = hasSubpixelPrecision ? 0.1 : 2; // enclosing may expand up to one pixel in each direction.
+    if (Math.abs(elementWidth - textWidth) <= tolerance)
         testPassed('Width of text element is the sum of the width of all characters.');
     else
-        testPassed('Width of text element is ' + elementWidth + ', expected ' + textWidth);
+        testFailed('Width of text element is ' + elementWidth + ', expected ' + textWidth);
 </script>
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to