Title: [95571] trunk/LayoutTests
Revision
95571
Author
[email protected]
Date
2011-09-20 14:59:44 -0700 (Tue, 20 Sep 2011)

Log Message

[CSSRegions] Need test case for 66198 (sliced line box rendering)
https://bugs.webkit.org/show_bug.cgi?id=68257

Patch by Alan Stearns <[email protected]> on 2011-09-20
Reviewed by David Hyatt.

* fast/regions/resources/helper.js:
(assertTopLeftMatch):
(sameTopLeft):
* fast/regions/no-split-line-box-expected.txt: Added.
* fast/regions/no-split-line-box.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95570 => 95571)


--- trunk/LayoutTests/ChangeLog	2011-09-20 21:47:07 UTC (rev 95570)
+++ trunk/LayoutTests/ChangeLog	2011-09-20 21:59:44 UTC (rev 95571)
@@ -1,3 +1,16 @@
+2011-09-20  Alan Stearns  <[email protected]>
+
+        [CSSRegions] Need test case for 66198 (sliced line box rendering)
+        https://bugs.webkit.org/show_bug.cgi?id=68257
+
+        Reviewed by David Hyatt.
+
+        * fast/regions/resources/helper.js:
+        (assertTopLeftMatch):
+        (sameTopLeft):
+        * fast/regions/no-split-line-box-expected.txt: Added.
+        * fast/regions/no-split-line-box.html: Added.
+
 2011-09-20  David Hyatt  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=68314

Added: trunk/LayoutTests/fast/regions/no-split-line-box-expected.txt (0 => 95571)


--- trunk/LayoutTests/fast/regions/no-split-line-box-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/no-split-line-box-expected.txt	2011-09-20 21:59:44 UTC (rev 95571)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/regions/no-split-line-box.html (0 => 95571)


--- trunk/LayoutTests/fast/regions/no-split-line-box.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/no-split-line-box.html	2011-09-20 21:59:44 UTC (rev 95571)
@@ -0,0 +1,54 @@
+<!--
+  Each of the two regions should only display two line boxes in this test. 
+  The buggy behavior splits the third line box between the first and second region.
+  --> 
+<script type="text/_javascript_" charset="utf-8" src=""
+
+<style type="text/css"> 
+  .article{
+    -webkit-flow: "thread";
+    line-height:14px;
+  }
+  .region{
+    content:-webkit-from-flow("thread");
+    width:4em;
+    height:35px;  /*2.5x line height*/
+    background-color:lightgray;
+  }
+  .divider{
+    width:4em;
+    height:10px;
+  }
+  .description{
+    color:blue;
+  }
+</style> 
+ 
+<div id="test">
+  <div class="region"></div> 
+  <div class="divider"></div> 
+  <div id="secondRegion" class="region"></div> 
+  <div class="article"> 
+    mnopqr mnopqr <span id="testSpan">m</span>nopqr mnopqr mnopqr mnopqr
+  </div>
+  <p class="description">The two regions on either side of the divider should each have two text lines.</p>
+  <p class="description">There should be no text line split between the regions.</p>
+  <p class="description">The top left corner of the third text line should be in the top left corner of the second region.</p>
+</div>
+<div id="result"></div>
+
+<script>
+  if (window.layoutTestController)
+    layoutTestController.dumpAsText(true);
+    
+  var testElement = document.getElementById("testSpan")
+  var testRect = testElement.getBoundingClientRect();
+  var regionElement = document.getElementById("secondRegion")
+  var regionRect = regionElement.getBoundingClientRect();
+  var resultString = assertTopLeftMatch (regionRect, testRect);
+
+  if (window.layoutTestController)
+  	document.getElementById("test").innerText="";
+  var resultDiv = document.getElementById("result");
+  resultDiv.innerText = resultString;
+</script>

Modified: trunk/LayoutTests/fast/regions/resources/helper.js (95570 => 95571)


--- trunk/LayoutTests/fast/regions/resources/helper.js	2011-09-20 21:47:07 UTC (rev 95570)
+++ trunk/LayoutTests/fast/regions/resources/helper.js	2011-09-20 21:59:44 UTC (rev 95571)
@@ -4,16 +4,19 @@
     return window.location.hash == "#debug";
 }
 
-function rectToArray(rect) {
+function rectToArray(rect)
+{
     return [rect.top, rect.left, rect.bottom, rect.right, rect.width, rect.height];
 }
 
-function areEqualNumbers(actual, expected, tolerance) {
+function areEqualNumbers(actual, expected, tolerance)
+{
     var diff = Math.abs(actual - expected);
     return diff <= tolerance;
 }
 
-function areEqualRects(r1, r2, tolerance) {
+function areEqualRects(r1, r2, tolerance)
+{
     if (r1.length != r2.length)
         return false;
     
@@ -24,7 +27,24 @@
     return true;
 }
 
-function assertEqualRects(results, name, actualRect, expectedRect, tolerance) {
+function assertTopLeftMatch (r1, r2, tolerance)
+{
+    if (sameTopLeft(r1, r2, tolerance))
+        return "PASS";
+    return "FAIL. Expected top left points to match, but got ("+ r1.top + "," + r1.left + ") and ("+ r2.top + "," + r2.left + ")";
+}
+
+function sameTopLeft(r1, r2, tolerance)
+{
+    if (tolerance === undefined)
+        tolerance = 0;
+    if ( areEqualNumbers(r1.top, r2.top, tolerance) && areEqualNumbers(r1.left, r2.left, tolerance) )
+        return true;
+    return false;
+}
+
+function assertEqualRects(results, name, actualRect, expectedRect, tolerance)
+{
     if (areEqualRects(actualRect, expectedRect, tolerance))
         return;
 
@@ -50,7 +70,8 @@
     return !results.length;
 }
 
-function assertRectContains(results, name, containerRect, insideRect, tolerance) {
+function assertRectContains(results, name, containerRect, insideRect, tolerance)
+{
     // make the container rect bigger with tolerance
     var left = containerRect.left - tolerance;
     var right = containerRect.right + tolerance;
@@ -63,7 +84,8 @@
     return pass;
 }
 
-function addPageLevelDebugBox(rect, color) {
+function addPageLevelDebugBox(rect, color)
+{
     var el = document.createElement("div");
     el.style.position = "absolute";
     el.style.left = rect.left + "px";
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to