Title: [94137] trunk/LayoutTests
Revision
94137
Author
[email protected]
Date
2011-08-30 17:29:46 -0700 (Tue, 30 Aug 2011)

Log Message

add a test for border/padding/margin on the flexbox container
https://bugs.webkit.org/show_bug.cgi?id=67243

Reviewed by Tony Chang.

* css3/flexbox/001-expected.txt:
* css3/flexbox/001.html:
* css3/flexbox/resources/flexbox.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94136 => 94137)


--- trunk/LayoutTests/ChangeLog	2011-08-31 00:26:51 UTC (rev 94136)
+++ trunk/LayoutTests/ChangeLog	2011-08-31 00:29:46 UTC (rev 94137)
@@ -1,3 +1,14 @@
+2011-08-30  Ojan Vafai  <[email protected]>
+
+        add a test for border/padding/margin on the flexbox container
+        https://bugs.webkit.org/show_bug.cgi?id=67243
+
+        Reviewed by Tony Chang.
+
+        * css3/flexbox/001-expected.txt:
+        * css3/flexbox/001.html:
+        * css3/flexbox/resources/flexbox.js:
+
 2011-08-30  Alice Boxhall  <[email protected]>
 
         Correctly report selected text range for accessibility APIs for role=textbox

Modified: trunk/LayoutTests/css3/flexbox/001-expected.txt (94136 => 94137)


--- trunk/LayoutTests/css3/flexbox/001-expected.txt	2011-08-31 00:26:51 UTC (rev 94136)
+++ trunk/LayoutTests/css3/flexbox/001-expected.txt	2011-08-31 00:29:46 UTC (rev 94137)
@@ -15,4 +15,5 @@
 PASS
 PASS
 PASS
+PASS
 

Modified: trunk/LayoutTests/css3/flexbox/001.html (94136 => 94137)


--- trunk/LayoutTests/css3/flexbox/001.html	2011-08-31 00:26:51 UTC (rev 94136)
+++ trunk/LayoutTests/css3/flexbox/001.html	2011-08-31 00:29:46 UTC (rev 94137)
@@ -141,5 +141,14 @@
   <div data-expected-width="200" style="width: -webkit-flex(1)"></div>
 </div>
 
+<!-- Test border/padding/margin on the flexbox itself. -->
+<div style="border: 10px solid; display: inline-block;">
+    <div data-expected-width="700" style="display: -webkit-flexbox; padding-left: 10px; padding-right: 20px; border-left: 30px solid; border-right: 40px solid; margin-left: 50px; margin-right:60px;" class="horizontal-box ">
+      <div data-offset-x="100" data-expected-width="200" style="width: -webkit-flex(1)"></div>
+      <div data-offset-x="300" data-expected-width="200" style="width: -webkit-flex(1)"></div>
+      <div data-offset-x="500" data-expected-width="200" style="width: -webkit-flex(1)"></div>
+    </div>
+</div>
+
 </body>
 </html>

Modified: trunk/LayoutTests/css3/flexbox/resources/flexbox.js (94136 => 94137)


--- trunk/LayoutTests/css3/flexbox/resources/flexbox.js	2011-08-31 00:26:51 UTC (rev 94136)
+++ trunk/LayoutTests/css3/flexbox/resources/flexbox.js	2011-08-31 00:29:46 UTC (rev 94137)
@@ -6,31 +6,35 @@
         referenceNode.parentNode.appendChild(nodeToAdd);
 }
 
+function checkExpectedValues(node, failures)
+{
+    var expectedWidth = node.getAttribute && node.getAttribute("data-expected-width");
+    if (node.offsetWidth && expectedWidth) {
+        if (node.offsetWidth != parseInt(expectedWidth))
+            failures.push("Expected " + expectedWidth + " for width, but got " + node.offsetWidth + ". ");
+    }
+
+    var expectedOffset = node.getAttribute && node.getAttribute("data-offset-x");
+    if (node.offsetLeft && expectedOffset) {
+        if (node.offsetLeft != parseInt(expectedOffset))
+            failures.push("Expected " + expectedOffset + " for offsetLeft, but got " + node.offsetLeft + ". ");
+    }
+}
+
 function checkHorizontalBoxen()
 {
     var flexboxen = document.getElementsByClassName("horizontal-box");
     Array.prototype.forEach.call(flexboxen, function(flexbox) {
-      var failures = "";
+      var failures = [];
+      checkExpectedValues(flexbox, failures);
+
       var child = flexbox.firstChild;
       while (child) {
-          var expectedWidth = child.getAttribute && child.getAttribute("data-expected-width");
-          if (child.offsetWidth && expectedWidth) {
-              if (child.offsetWidth != parseInt(expectedWidth)) {
-                  failures += "Expected " + expectedWidth + " for width, but got " + child.offsetWidth + ". ";
-              }
-          }
-
-          var expectedOffset = child.getAttribute && child.getAttribute("data-offset-x");
-          if (child.offsetLeft && expectedOffset) {
-              if (child.offsetLeft != parseInt(expectedOffset)) {
-                  failures += "Expected " + expectedOffset + " for offsetLeft, but got " + child.offsetLeft + ". ";
-              }
-          }
-
+          checkExpectedValues(child, failures);
           child = child.nextSibling;
       }
 
       insertAfter(document.createElement("p"), flexbox);
-      insertAfter(document.createTextNode(failures ? failures : "PASS"), flexbox);
+      insertAfter(document.createTextNode(failures.length ? failures.join('<br>') : "PASS"), flexbox);
     });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to