adding missing generated test cases in csharp, java, js

Summary:
@public
gentest.rb script generates tests in different languages cpp, java, csharp, js from html files.
Some tests were missing from csharp, java and js test files. This diff adds those in all the test files

Reviewed By: priteshrnandgaonkar

Differential Revision: D10853971

fbshipit-source-id: 11d7cee5889dd1f5a7440f6802fca78cea17aa4d
This commit is contained in:
Sidharth Guglani
2018-10-31 10:13:02 -07:00
committed by Facebook Github Bot
parent 1e4d0abc66
commit b7890fa2a8
5 changed files with 630 additions and 166 deletions

View File

@@ -4,7 +4,6 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
package com.facebook.yoga;
@@ -996,6 +995,158 @@ public class YGJustifyContentTest {
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_min_width_with_padding_child_width_greater_than_parent() {
YogaConfig config = new YogaConfig();
final YogaNode root = createNode(config);
root.setAlignContent(YogaAlign.STRETCH);
root.setWidth(1000f);
root.setHeight(1584f);
final YogaNode root_child0 = createNode(config);
root_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0.setAlignContent(YogaAlign.STRETCH);
root.addChildAt(root_child0, 0);
final YogaNode root_child0_child0 = createNode(config);
root_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0_child0.setJustifyContent(YogaJustify.CENTER);
root_child0_child0.setAlignContent(YogaAlign.STRETCH);
root_child0_child0.setPadding(YogaEdge.LEFT, 100);
root_child0_child0.setPadding(YogaEdge.RIGHT, 100);
root_child0_child0.setMinWidth(400f);
root_child0.addChildAt(root_child0_child0, 0);
final YogaNode root_child0_child0_child0 = createNode(config);
root_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0_child0_child0.setAlignContent(YogaAlign.STRETCH);
root_child0_child0_child0.setWidth(300f);
root_child0_child0_child0.setHeight(100f);
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(1000f, root.getLayoutWidth(), 0.0f);
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(1000f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
assertEquals(300f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(1000f, root.getLayoutWidth(), 0.0f);
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(1000f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(500f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(500f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
assertEquals(300f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
}
@Test
public void test_justify_content_min_width_with_padding_child_width_lower_than_parent() {
YogaConfig config = new YogaConfig();
final YogaNode root = createNode(config);
root.setAlignContent(YogaAlign.STRETCH);
root.setWidth(1080f);
root.setHeight(1584f);
final YogaNode root_child0 = createNode(config);
root_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0.setAlignContent(YogaAlign.STRETCH);
root.addChildAt(root_child0, 0);
final YogaNode root_child0_child0 = createNode(config);
root_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0_child0.setJustifyContent(YogaJustify.CENTER);
root_child0_child0.setAlignContent(YogaAlign.STRETCH);
root_child0_child0.setPadding(YogaEdge.LEFT, 100);
root_child0_child0.setPadding(YogaEdge.RIGHT, 100);
root_child0_child0.setMinWidth(400f);
root_child0.addChildAt(root_child0_child0, 0);
final YogaNode root_child0_child0_child0 = createNode(config);
root_child0_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0_child0_child0.setAlignContent(YogaAlign.STRETCH);
root_child0_child0_child0.setWidth(199f);
root_child0_child0_child0.setHeight(100f);
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(1080f, root.getLayoutWidth(), 0.0f);
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(400f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(101f, root_child0_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
assertEquals(199f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(1080f, root.getLayoutWidth(), 0.0f);
assertEquals(1584f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(1080f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(680f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(400f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(101f, root_child0_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
assertEquals(199f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
}
private YogaNode createNode(YogaConfig config) {
return mNodeFactory.create(config);
}