Add experiment support to gentest

Summary:
This diff does two things
- Clean up some of the generated code making the files smaller.
- Add experiment support to generated tests allowing us to use gentest for things still being experimented with such as more compliant flex-basis behavior.

Reviewed By: gkassabli

Differential Revision: D4226734

fbshipit-source-id: 2cc1471c21883e8e326f16e7a8bb1a3657acd84b
This commit is contained in:
Emil Sjolander
2016-11-23 11:12:51 -08:00
committed by Facebook Github Bot
parent a0d560a24b
commit 22b0fdb3e6
49 changed files with 6574 additions and 6119 deletions

View File

@@ -7,37 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="absolute_layout_width_height_start_top" style="width: 100px; height: 100px;">
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px;"></div>
</div>
<div id="absolute_layout_width_height_end_bottom" style="width: 100px; height: 100px;">
<div style="width:10px; height: 10px; position: absolute; end: 10px; bottom: 10px;"></div>
</div>
<div id="absolute_layout_start_top_end_bottom" style="width: 100px; height: 100px;">
<div style="position: absolute; start: 10px; top: 10px; end: 10px; bottom: 10px;"></div>
</div>
<div id="absolute_layout_width_height_start_top_end_bottom" style="width: 100px; height: 100px;">
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px; end: 10px; bottom: 10px;"></div>
</div>
<div id="do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent" style="height: 50px; width: 50px; overflow: hidden; flex-direction: row;">
<div style="position: absolute; start: 0px; top: 0px;">
<div style="width: 100px; height: 100px;"></div>
</div>
</div>
<div id="absolute_layout_within_border" style="height:100px; width:100px; border-width: 10px; margin: 10px; padding: 10px;">
<div style="position: absolute; width: 50px; height: 50px; left: 0px; top: 0px;"></div>
<div style="position: absolute; width: 50px; height: 50px; right: 0px; bottom: 0px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAbsolutePositionTest.html
package com.facebook.csslayout;
@@ -49,163 +19,163 @@ public class CSSLayoutAbsolutePositionTest {
@Test
public void test_absolute_layout_width_height_start_top() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 10);
root_child0.setPosition(Spacing.TOP, 10);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setPosition(Spacing.START, 10f);
root_child0.setPosition(Spacing.TOP, 10f);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_width_height_end_bottom() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.END, 10);
root_child0.setPosition(Spacing.BOTTOM, 10);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setPosition(Spacing.END, 10f);
root_child0.setPosition(Spacing.BOTTOM, 10f);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_start_top_end_bottom() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 10);
root_child0.setPosition(Spacing.TOP, 10);
root_child0.setPosition(Spacing.END, 10);
root_child0.setPosition(Spacing.BOTTOM, 10);
root_child0.setPosition(Spacing.START, 10f);
root_child0.setPosition(Spacing.TOP, 10f);
root_child0.setPosition(Spacing.END, 10f);
root_child0.setPosition(Spacing.BOTTOM, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_width_height_start_top_end_bottom() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 10);
root_child0.setPosition(Spacing.TOP, 10);
root_child0.setPosition(Spacing.END, 10);
root_child0.setPosition(Spacing.BOTTOM, 10);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setPosition(Spacing.START, 10f);
root_child0.setPosition(Spacing.TOP, 10f);
root_child0.setPosition(Spacing.END, 10f);
root_child0.setPosition(Spacing.BOTTOM, 10f);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -213,124 +183,124 @@ public class CSSLayoutAbsolutePositionTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setOverflow(CSSOverflow.HIDDEN);
root.setStyleWidth(50);
root.setStyleHeight(50);
root.setStyleWidth(50f);
root.setStyleHeight(50f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.START, 0);
root_child0.setPosition(Spacing.TOP, 0);
root_child0.setPosition(Spacing.START, 0f);
root_child0.setPosition(Spacing.TOP, 0f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setStyleWidth(100);
root_child0_child0.setStyleHeight(100);
root_child0_child0.setStyleWidth(100f);
root_child0_child0.setStyleHeight(100f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(50, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(50f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(50, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(50f, root.getLayoutHeight(), 0.0f);
assertEquals(-50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(-50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_absolute_layout_within_border() {
final CSSNode root = new CSSNode();
root.setMargin(Spacing.LEFT, 10);
root.setMargin(Spacing.TOP, 10);
root.setMargin(Spacing.RIGHT, 10);
root.setMargin(Spacing.BOTTOM, 10);
root.setMargin(Spacing.LEFT, 10f);
root.setMargin(Spacing.TOP, 10f);
root.setMargin(Spacing.RIGHT, 10f);
root.setMargin(Spacing.BOTTOM, 10f);
root.setPadding(Spacing.LEFT, 10);
root.setPadding(Spacing.TOP, 10);
root.setPadding(Spacing.RIGHT, 10);
root.setPadding(Spacing.BOTTOM, 10);
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE);
root_child0.setPosition(Spacing.LEFT, 0);
root_child0.setPosition(Spacing.TOP, 0);
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(50);
root_child0.setPosition(Spacing.LEFT, 0f);
root_child0.setPosition(Spacing.TOP, 0f);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setPositionType(CSSPositionType.ABSOLUTE);
root_child1.setPosition(Spacing.RIGHT, 0);
root_child1.setPosition(Spacing.BOTTOM, 0);
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(50);
root_child1.setPosition(Spacing.RIGHT, 0f);
root_child1.setPosition(Spacing.BOTTOM, 0f);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(50f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(10, root.getLayoutX(), 0.0f);
assertEquals(10, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(10f, root.getLayoutX(), 0.0f);
assertEquals(10f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(40, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(40f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(10, root.getLayoutX(), 0.0f);
assertEquals(10, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(10f, root.getLayoutX(), 0.0f);
assertEquals(10f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(40, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(40f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,42 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="align_content_flex_start" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: flex-start;">
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
</div>
<div id="align_content_flex_end" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: flex-end;">
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
</div>
<div id="align_content_center" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: center;">
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
<div style="width: 50px; height: 10px;"></div>
</div>
<div id="align_content_stretch" style="width: 100px; height: 100px; flex-wrap: wrap; flex-direction: column; align-content: stretch;">
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
<div style="width: 50px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignContentTest.html
package com.facebook.csslayout;
@@ -55,98 +20,98 @@ public class CSSLayoutAlignContentTest {
public void test_align_content_flex_start() {
final CSSNode root = new CSSNode();
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(10);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(10);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleHeight(10);
root_child3.setStyleWidth(50f);
root_child3.setStyleHeight(10f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleHeight(10);
root_child4.setStyleWidth(50f);
root_child4.setStyleHeight(10f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
}
@Test
@@ -154,98 +119,98 @@ public class CSSLayoutAlignContentTest {
final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.FLEX_END);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(10);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(10);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleHeight(10);
root_child3.setStyleWidth(50f);
root_child3.setStyleHeight(10f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleHeight(10);
root_child4.setStyleWidth(50f);
root_child4.setStyleHeight(10f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
}
@Test
@@ -253,98 +218,98 @@ public class CSSLayoutAlignContentTest {
final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.CENTER);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(10);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(10);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleHeight(10);
root_child3.setStyleWidth(50f);
root_child3.setStyleHeight(10f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleHeight(10);
root_child4.setStyleWidth(50f);
root_child4.setStyleHeight(10f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(40, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
}
@Test
@@ -352,93 +317,93 @@ public class CSSLayoutAlignContentTest {
final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.STRETCH);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleWidth(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleWidth(50f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleWidth(50f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(50);
root_child3.setStyleWidth(50f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setStyleWidth(50);
root_child4.setStyleWidth(50f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0, root_child4.getLayoutX(), 0.0f);
assertEquals(0, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0, root_child4.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(50, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(50, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(50, root_child4.getLayoutX(), 0.0f);
assertEquals(0, root_child4.getLayoutY(), 0.0f);
assertEquals(50, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0, root_child4.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,26 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="align_items_stretch" style="width: 100px; height: 100px;">
<div style="height: 10px;"></div>
</div>
<div id="align_items_center" style="width: 100px; height: 100px; align-items: center;">
<div style="height: 10px; width: 10px;"></div>
</div>
<div id="align_items_flex_start" style="width: 100px; height: 100px; align-items: flex-start;">
<div style="height: 10px; width: 10px;"></div>
</div>
<div id="align_items_flex_end" style="width: 100px; height: 100px; align-items: flex-end;">
<div style="height: 10px; width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignItemsTest.html
package com.facebook.csslayout;
@@ -38,151 +19,151 @@ public class CSSLayoutAlignItemsTest {
@Test
public void test_align_items_stretch() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_center() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.CENTER);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_flex_start() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_START);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_flex_end() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_END);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,26 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="align_self_center" style="width:100px; height: 100px;">
<div style="height: 10px; width: 10px; align-self: center;"></div>
</div>
<div id="align_self_flex_end" style="width:100px; height: 100px;">
<div style="height: 10px; width: 10px; align-self: flex-end;"></div>
</div>
<div id="align_self_flex_start" style="width:100px; height: 100px;">
<div style="height: 10px; width: 10px; align-self: flex-start;"></div>
</div>
<div id="align_self_flex_end_override_flex_start" style="width:100px; height: 100px; align-items: flex-start;">
<div style="height: 10px; width: 10px; align-self: flex-end;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutAlignSelfTest.html
package com.facebook.csslayout;
@@ -38,154 +19,154 @@ public class CSSLayoutAlignSelfTest {
@Test
public void test_align_self_center() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.CENTER);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(45, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_self_flex_end() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_END);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_self_flex_start() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_START);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_self_flex_end_override_flex_start() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_START);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_END);
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,29 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="border_no_size" style="border-width: 10px;">
</div>
<div id="border_container_match_child" style="border-width: 10px;">
<div style="width: 10px; height: 10px;"></div>
</div>
<div id="border_flex_child" style="width: 100px; height: 100px; border-width: 10px;">
<div style="width: 10px; flex-grow:1"></div>
</div>
<div id="border_stretch_child" style="width: 100px; height: 100px; border-width: 10px;">
<div style="height: 10px;"></div>
</div>
<div id="border_center_child" style="width: 100px; height: 100px; border-start-width: 10px; border-top-width: 10; border-end-width: 20px; border-bottom-width: 20px; align-items: center; justify-content: center;">
<div style="height: 10px; width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutBorderTest.html
package com.facebook.csslayout;
@@ -41,145 +19,145 @@ public class CSSLayoutBorderTest {
@Test
public void test_border_no_size() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
}
@Test
public void test_border_container_match_child() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_border_flex_child() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleWidth(10);
root_child0.setFlexGrow(1f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_border_stretch_child() {
final CSSNode root = new CSSNode();
root.setBorder(Spacing.LEFT, 10);
root.setBorder(Spacing.TOP, 10);
root.setBorder(Spacing.RIGHT, 10);
root.setBorder(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.LEFT, 10f);
root.setBorder(Spacing.TOP, 10f);
root.setBorder(Spacing.RIGHT, 10f);
root.setBorder(Spacing.BOTTOM, 10f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -187,41 +165,41 @@ public class CSSLayoutBorderTest {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER);
root.setAlignItems(CSSAlign.CENTER);
root.setBorder(Spacing.START, 10);
root.setBorder(Spacing.END, 20);
root.setBorder(Spacing.BOTTOM, 20);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setBorder(Spacing.START, 10f);
root.setBorder(Spacing.END, 20f);
root.setBorder(Spacing.BOTTOM, 20f);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(40, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,46 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="flex_direction_column_no_height" style="width: 100px">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="flex_direction_row_no_width" style="height: 100px; flex-direction: row;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="flex_direction_column" style="height: 100px; width: 100px;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="flex_direction_row" style="height: 100px; width: 100px; flex-direction: row;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
<div id="flex_direction_column_reverse" style="height: 100px; width: 100px; flex-direction: column-reverse;">
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
<div style="height: 10px;"></div>
</div>
<div id="flex_direction_row_reverse" style="height: 100px; width: 100px; flex-direction: row-reverse;">
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
<div style="width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexDirectionTest.html
package com.facebook.csslayout;
@@ -58,387 +19,387 @@ public class CSSLayoutFlexDirectionTest {
@Test
public void test_flex_direction_column_no_height() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleHeight(10);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleHeight(10);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_row_no_width() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleHeight(100);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(10);
root_child1.setStyleWidth(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(10);
root_child2.setStyleWidth(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(20, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleHeight(10);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleHeight(10);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(20, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(10);
root_child1.setStyleWidth(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(10);
root_child2.setStyleWidth(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(20, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(70, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_column_reverse() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.COLUMN_REVERSE);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleHeight(10);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleHeight(10);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(90, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(90f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(70, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(70f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(90, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(90f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(70, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(70f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_direction_row_reverse() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW_REVERSE);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(10);
root_child1.setStyleWidth(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(10);
root_child2.setStyleWidth(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(70, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(10, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(20, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(10, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100, root_child2.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,48 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="flex_basis_flex_grow_column" style="width: 100px; height: 100px;">
<div style="flex-basis: 50px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="flex_basis_flex_grow_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-basis: 50px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="flex_basis_flex_shrink_column" style="width: 100px; height: 100px;">
<div style="flex-basis: 100px; flex-shrink: 1;"></div>
<div style="flex-basis: 50px;"></div>
</div>
<div id="flex_basis_flex_shrink_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="flex-basis: 100px; flex-shrink: 1;"></div>
<div style="flex-basis: 50px;"></div>
</div>
<div id="flex_shrink_to_zero" style="height: 75px;">
<div style="width: 50px; height: 50px; flex-shrink:0;"></div>
<div style="width: 50px; height: 50px; flex-shrink:1;"></div>
<div style="width: 50px; height: 50px; flex-shrink:0;"></div>
</div>
<div id="flex_basis_overrides_main_size" style="height: 100px; width: 100px;">
<div style="height: 20px; flex-grow:1; flex-basis:50px;"></div>
<div style="height: 10px; flex-grow:1;"></div>
<div style="height: 10px; flex-grow:1;"></div>
</div>
<div id="flex_grow_shrink_at_most" style="height: 100px; width: 100px;">
<div>
<div style="flex-grow:1; flex-shrink:1;"></div>
</div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexTest.html
package com.facebook.csslayout;
@@ -60,392 +19,392 @@ public class CSSLayoutFlexTest {
@Test
public void test_flex_basis_flex_grow_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexBasis(50);
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(75, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(75f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(75, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_flex_grow_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexBasis(50);
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(75, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(75f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(75, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(25, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(25, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(75, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(75f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(25, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_flex_shrink_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexShrink(1);
root_child0.setFlexBasis(100);
root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(50);
root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_flex_shrink_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexShrink(1);
root_child0.setFlexBasis(100);
root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(50);
root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_shrink_to_zero() {
final CSSNode root = new CSSNode();
root.setStyleHeight(75);
root.setStyleHeight(75f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(50);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexShrink(1);
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(50);
root_child1.setFlexShrink(1f);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(50f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(50);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(75, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(75f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(50, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(50f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(75, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(75f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(50, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(50f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_basis_overrides_main_size() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexBasis(50);
root_child0.setStyleHeight(20);
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setStyleHeight(10);
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1);
root_child2.setStyleHeight(10);
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(60, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(60f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(60, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(60f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(100, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_grow_shrink_at_most() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1);
root_child0_child0.setFlexShrink(1);
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setFlexShrink(1f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,38 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="wrap_column" style="height: 100px; flex-wrap: wrap">
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
<div id="wrap_row" style="width: 100px; flex-direction: row; flex-wrap: wrap">
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
<div id="wrap_row_align_items_flex_end" style="width: 100px; flex-direction: row; flex-wrap: wrap; align-items: flex-end;">
<div style="height: 10px; width: 30px;"></div>
<div style="height: 20px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
<div id="wrap_row_align_items_center" style="width: 100px; flex-direction: row; flex-wrap: wrap; align-items: center;">
<div style="height: 10px; width: 30px;"></div>
<div style="height: 20px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutFlexWrapTest.html
package com.facebook.csslayout;
@@ -51,82 +20,82 @@ public class CSSLayoutFlexWrapTest {
public void test_wrap_column() {
final CSSNode root = new CSSNode();
root.setWrap(CSSWrap.WRAP);
root.setStyleHeight(100);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(30);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(30f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(30);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(30f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(60, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(60f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(60, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(60f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(30, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(60, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(60f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(30, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30, root_child2.getLayoutX(), 0.0f);
assertEquals(60, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child2.getLayoutX(), 0.0f);
assertEquals(60f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(0, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
@Test
@@ -134,82 +103,82 @@ public class CSSLayoutFlexWrapTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(30);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(30f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(30);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(30f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(60, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(60f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(70, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30, root_child0.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
@Test
@@ -218,82 +187,82 @@ public class CSSLayoutFlexWrapTest {
root.setFlexDirection(CSSFlexDirection.ROW);
root.setAlignItems(CSSAlign.FLEX_END);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(20);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(20f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(60, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(60f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(70, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(10, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
@Test
@@ -302,82 +271,82 @@ public class CSSLayoutFlexWrapTest {
root.setFlexDirection(CSSFlexDirection.ROW);
root.setAlignItems(CSSAlign.CENTER);
root.setWrap(CSSWrap.WRAP);
root.setStyleWidth(100);
root.setStyleWidth(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(30);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(30f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(30);
root_child1.setStyleHeight(20);
root_child1.setStyleWidth(30f);
root_child1.setStyleHeight(20f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(30);
root_child2.setStyleHeight(30);
root_child2.setStyleWidth(30f);
root_child2.setStyleHeight(30f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setStyleWidth(30);
root_child3.setStyleHeight(30);
root_child3.setStyleWidth(30f);
root_child3.setStyleHeight(30f);
root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30, root_child1.getLayoutX(), 0.0f);
assertEquals(5, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(5f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(60, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(60f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(60, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(60f, root.getLayoutHeight(), 0.0f);
assertEquals(70, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(30, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(30f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40, root_child1.getLayoutX(), 0.0f);
assertEquals(5, root_child1.getLayoutY(), 0.0f);
assertEquals(30, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
assertEquals(5f, root_child1.getLayoutY(), 0.0f);
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(10, root_child2.getLayoutX(), 0.0f);
assertEquals(0, root_child2.getLayoutY(), 0.0f);
assertEquals(30, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30, root_child2.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(70, root_child3.getLayoutX(), 0.0f);
assertEquals(30, root_child3.getLayoutY(), 0.0f);
assertEquals(30, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30, root_child3.getLayoutHeight(), 0.0f);
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,52 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="margin_start" style="width: 100px; height: 100px; flex-direction: row;">
<div style="width: 10px; margin-start: 10px;"></div>
</div>
<div id="margin_top" style="width: 100px; height: 100px;">
<div style="height: 10px; margin-top: 10px;"></div>
</div>
<div id="margin_end" style="width: 100px; height: 100px; flex-direction: row; justify-content: flex-end;">
<div style="width: 10px; margin-end: 10px;"></div>
</div>
<div id="margin_bottom" style="width: 100px; height: 100px; justify-content: flex-end;">
<div style="height: 10px; margin-bottom: 10px;"></div>
</div>
<div id="margin_and_flex_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="margin-start: 10px; margin-end; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_and_flex_column" style="width: 100px; height: 100px;">
<div style="margin-top: 10px; margin-bottom; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_and_stretch_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="margin-top: 10px; margin-bottom; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_and_stretch_column" style="width: 100px; height: 100px;">
<div style="margin-start: 10px; margin-end; 10px; flex-grow: 1;"></div>
</div>
<div id="margin_with_sibling_row" style="width: 100px; height: 100px; flex-direction: row;">
<div style="margin-end; 10px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="margin_with_sibling_column" style="width: 100px; height: 100px;">
<div style="margin-bottom; 10px; flex-grow: 1;"></div>
<div style="flex-grow: 1;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutMarginTest.html
package com.facebook.csslayout;
@@ -65,75 +20,75 @@ public class CSSLayoutMarginTest {
public void test_margin_start() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.START, 10);
root_child0.setStyleWidth(10);
root_child0.setMargin(Spacing.START, 10f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_top() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.TOP, 10);
root_child0.setStyleHeight(10);
root_child0.setMargin(Spacing.TOP, 10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -141,327 +96,327 @@ public class CSSLayoutMarginTest {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setJustifyContent(CSSJustify.FLEX_END);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.END, 10);
root_child0.setStyleWidth(10);
root_child0.setMargin(Spacing.END, 10f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_bottom() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.FLEX_END);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(Spacing.BOTTOM, 10);
root_child0.setStyleHeight(10);
root_child0.setMargin(Spacing.BOTTOM, 10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(80, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(80f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_flex_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.START, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.START, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_flex_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.TOP, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.TOP, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_stretch_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.TOP, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.TOP, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_and_stretch_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setMargin(Spacing.START, 10);
root_child0.setFlexGrow(1f);
root_child0.setMargin(Spacing.START, 10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(90, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_with_sibling_row() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_margin_with_sibling_column() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(50, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,54 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="max_width" style="width: 100px; height: 100px;">
<div style="height: 10px; max-width: 50px;"></div>
</div>
<div id="max_height" style="width: 100px; height: 100px; flex-direction: row;">
<div style="width: 10px; max-height: 50px;"></div>
</div>
<div id="min_height" style="width: 100px; height: 100px;">
<div style="flex-grow: 1; min-height: 60px;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="min_width" style="width: 100px; height: 100px; flex-direction: row">
<div style="flex-grow: 1; min-width: 60px;"></div>
<div style="flex-grow: 1;"></div>
</div>
<div id="justify_content_min_max" style="max-height: 200px; min-height: 100px; width: 100px; justify-content: center;">
<div style="width: 60px; height: 60px;"></div>
</div>
<div id="align_items_min_max" style="max-width: 200px; min-width: 100px; height: 100px; align-items: center;">
<div style="width: 60px; height: 60px;"></div>
</div>
<div id="justify_content_overflow_min_max" style="min-height: 100px; max-height: 110px; justify-content: center;">
<div style="width: 50px; height: 50px;"></div>
<div style="width: 50px; height: 50px;"></div>
<div style="width: 50px; height: 50px;"></div>
</div>
<div id="flex_grow_within_max_width" style="width: 200px; height: 100px;">
<div style="flex-direction: row; max-width: 100px;">
<div style="height: 20px; flex-grow: 1;"></div>
</div>
</div>
<div id="flex_grow_within_constrained_max_width" style="width: 200px; height: 100px;">
<div style="flex-direction: row; max-width: 300px;">
<div style="height: 20px; flex-grow: 1;"></div>
</div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutMinMaxDimensionTest.html
package com.facebook.csslayout;
@@ -66,429 +19,429 @@ public class CSSLayoutMinMaxDimensionTest {
@Test
public void test_max_width() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleMaxWidth(50);
root_child0.setStyleHeight(10);
root_child0.setStyleMaxWidth(50f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_max_height() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleMaxHeight(50);
root_child0.setStyleWidth(10f);
root_child0.setStyleMaxHeight(50f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_min_height() {
final CSSNode root = new CSSNode();
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleMinHeight(60);
root_child0.setFlexGrow(1f);
root_child0.setStyleMinHeight(60f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(80, root_child1.getLayoutY(), 0.0f);
assertEquals(100, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(80f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_min_width() {
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleMinWidth(60);
root_child0.setFlexGrow(1f);
root_child0.setStyleMinWidth(60f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1);
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(20, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(20f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(0, root_child1.getLayoutY(), 0.0f);
assertEquals(20, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(20f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_min_max() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER);
root.setStyleWidth(100);
root.setStyleMinHeight(100);
root.setStyleMaxHeight(200);
root.setStyleWidth(100f);
root.setStyleMinHeight(100f);
root.setStyleMaxHeight(200f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(60);
root_child0.setStyleHeight(60);
root_child0.setStyleWidth(60f);
root_child0.setStyleHeight(60f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(40, root_child0.getLayoutX(), 0.0f);
assertEquals(20, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_items_min_max() {
final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.CENTER);
root.setStyleMinWidth(100);
root.setStyleMaxWidth(200);
root.setStyleHeight(100);
root.setStyleMinWidth(100f);
root.setStyleMaxWidth(200f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(60);
root_child0.setStyleHeight(60);
root_child0.setStyleWidth(60f);
root_child0.setStyleHeight(60f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(20, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(60, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60, root_child0.getLayoutHeight(), 0.0f);
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_overflow_min_max() {
final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER);
root.setStyleMinHeight(100);
root.setStyleMaxHeight(110);
root.setStyleMinHeight(100f);
root.setStyleMaxHeight(110f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(50);
root_child0.setStyleHeight(50);
root_child0.setStyleWidth(50f);
root_child0.setStyleHeight(50f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setStyleWidth(50);
root_child1.setStyleHeight(50);
root_child1.setStyleWidth(50f);
root_child1.setStyleHeight(50f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setStyleWidth(50);
root_child2.setStyleHeight(50);
root_child2.setStyleWidth(50f);
root_child2.setStyleHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(110, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(110f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(-20, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(-20f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(50, root.getLayoutWidth(), 0.0f);
assertEquals(110, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(50f, root.getLayoutWidth(), 0.0f);
assertEquals(110f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(-20, root_child0.getLayoutY(), 0.0f);
assertEquals(50, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(-20f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child1.getLayoutX(), 0.0f);
assertEquals(30, root_child1.getLayoutY(), 0.0f);
assertEquals(50, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(30f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0, root_child2.getLayoutX(), 0.0f);
assertEquals(80, root_child2.getLayoutY(), 0.0f);
assertEquals(50, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50, root_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(80f, root_child2.getLayoutY(), 0.0f);
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_grow_within_max_width() {
final CSSNode root = new CSSNode();
root.setStyleWidth(200);
root.setStyleHeight(100);
root.setStyleWidth(200f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexDirection(CSSFlexDirection.ROW);
root_child0.setStyleMaxWidth(100);
root_child0.setStyleMaxWidth(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1);
root_child0_child0.setStyleHeight(20);
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setStyleHeight(20f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(100, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_flex_grow_within_constrained_max_width() {
final CSSNode root = new CSSNode();
root.setStyleWidth(200);
root.setStyleHeight(100);
root.setStyleWidth(200f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexDirection(CSSFlexDirection.ROW);
root_child0.setStyleMaxWidth(300);
root_child0.setStyleMaxWidth(300f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1);
root_child0_child0.setStyleHeight(20);
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setStyleHeight(20f);
root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(200, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
}
}

View File

@@ -7,29 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* @Generated by gentest/gentest.sh with the following input
*
<div id="padding_no_size" style="padding: 10px;">
</div>
<div id="padding_container_match_child" style="padding: 10px;">
<div style="width: 10px; height: 10px;"></div>
</div>
<div id="padding_flex_child" style="width: 100px; height: 100px; padding: 10px;">
<div style="width: 10px; flex-grow:1"></div>
</div>
<div id="padding_stretch_child" style="width: 100px; height: 100px; padding: 10px;">
<div style="height: 10px;"></div>
</div>
<div id="padding_center_child" style="width: 100px; height: 100px; padding-start: 10px; padding-top: 10; padding-end: 20px; padding-bottom: 20px; align-items: center; justify-content: center;">
<div style="height: 10px; width: 10px;"></div>
</div>
*
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutPaddingTest.html
package com.facebook.csslayout;
@@ -48,18 +26,18 @@ public class CSSLayoutPaddingTest {
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(20, root.getLayoutWidth(), 0.0f);
assertEquals(20, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f);
}
@Test
@@ -71,34 +49,34 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.BOTTOM, 10);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(30, root.getLayoutWidth(), 0.0f);
assertEquals(30, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(30f, root.getLayoutWidth(), 0.0f);
assertEquals(30f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -108,38 +86,38 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.TOP, 10);
root.setPadding(Spacing.RIGHT, 10);
root.setPadding(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1);
root_child0.setStyleWidth(10);
root_child0.setFlexGrow(1f);
root_child0.setStyleWidth(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(80, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80, root_child0.getLayoutHeight(), 0.0f);
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -149,37 +127,37 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.TOP, 10);
root.setPadding(Spacing.RIGHT, 10);
root.setPadding(Spacing.BOTTOM, 10);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleHeight(10);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(10, root_child0.getLayoutX(), 0.0f);
assertEquals(10, root_child0.getLayoutY(), 0.0f);
assertEquals(80, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
@Test
@@ -190,38 +168,38 @@ public class CSSLayoutPaddingTest {
root.setPadding(Spacing.START, 10);
root.setPadding(Spacing.END, 20);
root.setPadding(Spacing.BOTTOM, 20);
root.setStyleWidth(100);
root.setStyleHeight(100);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setStyleWidth(10);
root_child0.setStyleHeight(10);
root_child0.setStyleWidth(10f);
root_child0.setStyleHeight(10f);
root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(40, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0, root.getLayoutX(), 0.0f);
assertEquals(0, root.getLayoutY(), 0.0f);
assertEquals(100, root.getLayoutWidth(), 0.0f);
assertEquals(100, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50, root_child0.getLayoutX(), 0.0f);
assertEquals(35, root_child0.getLayoutY(), 0.0f);
assertEquals(10, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(35f, root_child0.getLayoutY(), 0.0f);
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
}
}

View File

@@ -0,0 +1,795 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/CSSLayoutRoundingTest.html
package com.facebook.csslayout;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class CSSLayoutRoundingTest {
@Test
public void test_rounding_flex_basis_flex_grow_row_width_of_100() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(100f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(33f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(33f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(34f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(67f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(33f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(67f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(33f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(33f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(34f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(33f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_flex_basis_flex_grow_row_prime_number_width() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(113f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root.addChildAt(root_child2, 2);
final CSSNode root_child3 = new CSSNode();
root_child3.setFlexGrow(1f);
root.addChildAt(root_child3, 3);
final CSSNode root_child4 = new CSSNode();
root_child4.setFlexGrow(1f);
root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(113f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(23f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(23f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(22f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(23f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(68f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(22f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(23f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(113f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(23f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(68f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(22f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(45f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(23f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
assertEquals(23f, root_child3.getLayoutX(), 0.0f);
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
assertEquals(22f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
assertEquals(23f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_flex_basis_flex_shrink_row() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW);
root.setStyleWidth(101f);
root.setStyleHeight(100f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexShrink(1f);
root_child0.setFlexBasis(100f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(25f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexBasis(25f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(101f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(51f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(51f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(76f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(101f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(51f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_flex_basis_overrides_main_size() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(100f);
root.setStyleHeight(113f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_total_fractial() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(87.4f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(0.7f);
root_child0.setFlexBasis(50.3f);
root_child0.setStyleHeight(20.3f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1.6f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1.1f);
root_child2.setStyleHeight(10.7f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_total_fractial_nested() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(87.4f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(0.7f);
root_child0.setFlexBasis(50.3f);
root_child0.setStyleHeight(20.3f);
root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1f);
root_child0_child0.setFlexBasis(0.3f);
root_child0_child0.setPosition(Spacing.BOTTOM, 13.3f);
root_child0_child0.setStyleHeight(9.9f);
root_child0.addChildAt(root_child0_child0, 0);
final CSSNode root_child0_child1 = new CSSNode();
root_child0_child1.setFlexGrow(4f);
root_child0_child1.setFlexBasis(0.3f);
root_child0_child1.setPosition(Spacing.TOP, 13.3f);
root_child0_child1.setStyleHeight(1.1f);
root_child0.addChildAt(root_child0_child1, 1);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1.6f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1.1f);
root_child2.setStyleHeight(10.7f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(-13f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(12f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
assertEquals(25f, root_child0_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child1.getLayoutWidth(), 0.0f);
assertEquals(47f, root_child0_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(87f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(59f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(-13f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(12f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
assertEquals(25f, root_child0_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child0_child1.getLayoutWidth(), 0.0f);
assertEquals(47f, root_child0_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(59f, root_child1.getLayoutY(), 0.0f);
assertEquals(87f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_1() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(100f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_2() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setStyleWidth(100f);
root.setStyleHeight(113.6f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(65f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(65f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_3() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setPosition(Spacing.TOP, 0.3f);
root.setStyleWidth(100f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(114f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
@Test
public void test_rounding_fractial_input_4() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode();
root.setPosition(Spacing.TOP, 0.7f);
root.setStyleWidth(100f);
root.setStyleHeight(113.4f);
final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f);
root_child0.setFlexBasis(50f);
root_child0.setStyleHeight(20f);
root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f);
root_child1.setStyleHeight(10f);
root.addChildAt(root_child1, 1);
final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f);
root_child2.setStyleHeight(10f);
root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(1f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL);
root.calculateLayout(null);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(1f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(113f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false);
}
}