Add JS Linting

This commit is contained in:
Nick Gerleman
2022-12-24 01:46:20 -08:00
parent 014986e9da
commit 4d17e309d2
47 changed files with 1447 additions and 561 deletions

View File

@@ -8,7 +8,7 @@
const ITERATIONS = 2000;
const YGBENCHMARK = global.YGBENCHMARK ?? global.test;
YGBENCHMARK("Stack with flex", function() {
YGBENCHMARK("Stack with flex", function () {
var root = Yoga.Node.create();
root.setWidth(100);
root.setHeight(100);
@@ -26,7 +26,7 @@ YGBENCHMARK("Stack with flex", function() {
root.freeRecursive();
});
YGBENCHMARK("Align stretch in undefined axis", function() {
YGBENCHMARK("Align stretch in undefined axis", function () {
var root = Yoga.Node.create();
var measureCounter = getMeasureCounter(Yoga);
@@ -42,7 +42,7 @@ YGBENCHMARK("Align stretch in undefined axis", function() {
root.freeRecursive();
});
YGBENCHMARK("Nested flex", function() {
YGBENCHMARK("Nested flex", function () {
var root = Yoga.Node.create();
var measureCounter = getMeasureCounter(Yoga);
@@ -66,7 +66,7 @@ YGBENCHMARK("Nested flex", function() {
root.freeRecursive();
});
YGBENCHMARK("Huge nested layout", function() {
YGBENCHMARK("Huge nested layout", function () {
var root = Yoga.Node.create();
var iterations = Math.pow(ITERATIONS, 1 / 4);

View File

@@ -5,11 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/
it("align_baseline_parent_using_child_in_column_as_reference", function () {
test("align_baseline_parent_using_child_in_column_as_reference", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(1000);
root.setHeight(1000);
@@ -42,34 +43,17 @@ it("align_baseline_parent_using_child_in_column_as_reference", function () {
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
console.assert(0 === root_child0.getComputedLeft(),
"0 === root_child0.getComputedLeft() (" +
root_child0.getComputedLeft() + ")");
console.assert(100 === root_child0.getComputedTop(),
"100 === root_child0.getComputedTop() (" +
root_child0.getComputedTop() + ")");
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(100);
console.assert(500 === root_child1.getComputedLeft(),
"500 === root_child1.getComputedLeft() (" +
root_child1.getComputedLeft() + ")");
console.assert(0 === root_child1.getComputedTop(),
"0 === root_child1.getComputedTop() (" +
root_child1.getComputedTop() + ")");
expect(root_child1.getComputedLeft()).toBe(500);
expect(root_child1.getComputedTop()).toBe(0);
console.assert(0 === root_child1_child0.getComputedLeft(),
"0 === root_child1_child0.getComputedLeft() (" +
root_child1_child0.getComputedLeft() + ")");
console.assert(0 === root_child1_child0.getComputedTop(),
"0 === root_child1_child0.getComputedTop() (" +
root_child1_child0.getComputedTop() + ")");
console.assert(0 === root_child1_child1.getComputedLeft(),
"0 === root_child1_child1.getComputedLeft() (" +
root_child1_child1.getComputedLeft() + ")");
console.assert(300 === root_child1_child1.getComputedTop(),
"300 === root_child1_child1.getComputedTop() (" +
root_child1_child1.getComputedTop() + ")");
expect(root_child1_child0.getComputedLeft()).toBe(0);
expect(root_child1_child0.getComputedTop()).toBe(0);
expect(root_child1_child1.getComputedLeft()).toBe(0);
expect(root_child1_child1.getComputedTop()).toBe(300);
} finally {
if (typeof root !== "undefined") {
root.freeRecursive();
@@ -79,11 +63,12 @@ it("align_baseline_parent_using_child_in_column_as_reference", function () {
}
});
it("align_baseline_parent_using_child_in_row_as_reference", function () {
test("align_baseline_parent_using_child_in_row_as_reference", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(1000);
root.setHeight(1000);
@@ -116,34 +101,17 @@ it("align_baseline_parent_using_child_in_row_as_reference", function () {
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
console.assert(0 === root_child0.getComputedLeft(),
"0 === root_child0.getComputedLeft() (" +
root_child0.getComputedLeft() + ")");
console.assert(0 === root_child0.getComputedTop(),
"0 === root_child0.getComputedTop() (" +
root_child0.getComputedTop() + ")");
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(0);
console.assert(500 === root_child1.getComputedLeft(),
"500 === root_child1.getComputedLeft() (" +
root_child1.getComputedLeft() + ")");
console.assert(200 === root_child1.getComputedTop(),
"200 === root_child1.getComputedTop() (" +
root_child1.getComputedTop() + ")");
expect(root_child1.getComputedLeft()).toBe(500);
expect(root_child1.getComputedTop()).toBe(200);
console.assert(0 === root_child1_child0.getComputedLeft(),
"0 === root_child1_child0.getComputedLeft() (" +
root_child1_child0.getComputedLeft() + ")");
console.assert(0 === root_child1_child0.getComputedTop(),
"0 === root_child1_child0.getComputedTop() (" +
root_child1_child0.getComputedTop() + ")");
console.assert(500 === root_child1_child1.getComputedLeft(),
"500 === root_child1_child1.getComputedLeft() (" +
root_child1_child1.getComputedLeft() + ")");
console.assert(0 === root_child1_child1.getComputedTop(),
"0 === root_child1_child1.getComputedTop() (" +
root_child1_child1.getComputedTop() + ")");
expect(root_child1_child0.getComputedLeft()).toBe(0);
expect(root_child1_child0.getComputedTop()).toBe(0);
expect(root_child1_child1.getComputedLeft()).toBe(500);
expect(root_child1_child1.getComputedTop()).toBe(0);
} finally {
if (typeof root !== "undefined") {
root.freeRecursive();

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
it("border_start", function () {
test("border_start", function () {
const root = Yoga.Node.create();
root.setWidth(100);
root.setHeight(100);
@@ -13,17 +13,13 @@ it("border_start", function () {
root.calculateLayout(100, 100, Yoga.DIRECTION_LTR);
console.assert(10 === root.getComputedBorder(Yoga.EDGE_LEFT), "10 === root.getComputedBorder(Yoga.EDGE_LEFT)");
console.assert(0 === root.getComputedBorder(Yoga.EDGE_RIGHT), "0 === root.getComputedBorder(Yoga.EDGE_RIGHT)");
expect(root.getComputedBorder(Yoga.EDGE_LEFT)).toBe(10);
expect(root.getComputedBorder(Yoga.EDGE_RIGHT)).toBe(0);
root.calculateLayout(100, 100, Yoga.DIRECTION_RTL);
console.assert(0 === root.getComputedBorder(Yoga.EDGE_LEFT), "0 === root.getComputedBorder(Yoga.EDGE_LEFT)");
console.assert(10 === root.getComputedBorder(Yoga.EDGE_RIGHT), "10 === root.getComputedBorder(Yoga.EDGE_RIGHT)");
expect(root.getComputedBorder(Yoga.EDGE_LEFT)).toBe(0);
expect(root.getComputedBorder(Yoga.EDGE_RIGHT)).toBe(10);
if (typeof root !== "undefined")
root.freeRecursive();
(typeof gc !== "undefined") && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
it("margin_start", function () {
test("margin_start", function () {
const root = Yoga.Node.create();
root.setWidth(100);
root.setHeight(100);
@@ -13,17 +13,13 @@ it("margin_start", function () {
root.calculateLayout(100, 100, Yoga.DIRECTION_LTR);
console.assert(10 === root.getComputedMargin(Yoga.EDGE_LEFT), "10 === root.getComputedMargin(Yoga.EDGE_LEFT)");
console.assert(0 === root.getComputedMargin(Yoga.EDGE_RIGHT), "0 === root.getComputedMargin(Yoga.EDGE_RIGHT)");
expect(root.getComputedMargin(Yoga.EDGE_LEFT)).toBe(10);
expect(root.getComputedMargin(Yoga.EDGE_RIGHT)).toBe(0);
root.calculateLayout(100, 100, Yoga.DIRECTION_RTL);
console.assert(0 === root.getComputedMargin(Yoga.EDGE_LEFT), "0 === root.getComputedMargin(Yoga.EDGE_LEFT)");
console.assert(10 === root.getComputedMargin(Yoga.EDGE_RIGHT), "10 === root.getComputedMargin(Yoga.EDGE_RIGHT)");
expect(root.getComputedMargin(Yoga.EDGE_LEFT)).toBe(0);
expect(root.getComputedMargin(Yoga.EDGE_RIGHT)).toBe(10);
if (typeof root !== "undefined")
root.freeRecursive();
(typeof gc !== "undefined") && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
it("padding_start", function () {
test("padding_start", function () {
const root = Yoga.Node.create();
root.setWidth(100);
root.setHeight(100);
@@ -13,17 +13,13 @@ it("padding_start", function () {
root.calculateLayout(100, 100, Yoga.DIRECTION_LTR);
console.assert(10 === root.getComputedPadding(Yoga.EDGE_LEFT), "10 === root.getComputedPadding(Yoga.EDGE_LEFT)");
console.assert(0 === root.getComputedPadding(Yoga.EDGE_RIGHT), "0 === root.getComputedPadding(Yoga.EDGE_RIGHT)");
expect(root.getComputedPadding(Yoga.EDGE_LEFT)).toBe(10);
expect(root.getComputedPadding(Yoga.EDGE_RIGHT)).toBe(0);
root.calculateLayout(100, 100, Yoga.DIRECTION_RTL);
console.assert(0 === root.getComputedPadding(Yoga.EDGE_LEFT), "0 === root.getComputedPadding(Yoga.EDGE_LEFT)");
console.assert(10 === root.getComputedPadding(Yoga.EDGE_RIGHT), "10 === root.getComputedPadding(Yoga.EDGE_RIGHT)");
expect(root.getComputedPadding(Yoga.EDGE_LEFT)).toBe(0);
expect(root.getComputedPadding(Yoga.EDGE_RIGHT)).toBe(10);
if (typeof root !== "undefined")
root.freeRecursive();
(typeof gc !== "undefined") && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
it("dirtied", function() {
test("dirtied", function () {
const root = Yoga.Node.create();
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
@@ -14,28 +14,26 @@ it("dirtied", function() {
root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
let dirtied = 0;
root.setDirtiedFunc(function() { dirtied++; });
root.setDirtiedFunc(function () {
dirtied++;
});
// only nodes with a measure function can be marked dirty
root.setMeasureFunc(function() {});
root.setMeasureFunc(function () {});
console.assert(0 === dirtied, "0 === dirtied");
expect(dirtied).toBe(0);
// dirtied func MUST be called in case of explicit dirtying.
root.markDirty();
console.assert(1 === dirtied, "1 === dirtied");
expect(dirtied).toBe(1);
// dirtied func MUST be called ONCE.
root.markDirty();
console.assert(1 === dirtied, "1 === dirtied");
expect(dirtied).toBe(1);
if (typeof root !== "undefined")
root.freeRecursive();
typeof gc !== "undefined" && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});
it("dirtied_propagation", function() {
test("dirtied_propagation", function () {
const root = Yoga.Node.create();
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
@@ -45,7 +43,7 @@ it("dirtied_propagation", function() {
root_child0.setAlignItems(Yoga.ALIGN_FLEX_START);
root_child0.setWidth(50);
root_child0.setHeight(20);
root_child0.setMeasureFunc(function() {});
root_child0.setMeasureFunc(function () {});
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create();
@@ -57,91 +55,85 @@ it("dirtied_propagation", function() {
root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
let dirtied = 0;
root.setDirtiedFunc(function() { dirtied++; });
console.assert(0 === dirtied, "0 === dirtied");
// dirtied func MUST be called for the first time.
root_child0.markDirty();
console.assert(1 === dirtied, "1 === dirtied");
// dirtied func must NOT be called for the second time.
root_child0.markDirty();
console.assert(1 === dirtied, "1 === dirtied");
if (typeof root !== "undefined")
root.freeRecursive();
typeof gc !== "undefined" && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
});
it("dirtied_hierarchy", function() {
const root = Yoga.Node.create();
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create();
root_child0.setAlignItems(Yoga.ALIGN_FLEX_START);
root_child0.setWidth(50);
root_child0.setHeight(20);
root_child0.setMeasureFunc(function() {});
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create();
root_child1.setAlignItems(Yoga.ALIGN_FLEX_START);
root_child1.setWidth(50);
root_child1.setHeight(20);
root_child1.setMeasureFunc(function() {});
root.insertChild(root_child1, 0);
root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
let dirtied = 0;
root_child0.setDirtiedFunc(function() {
root.setDirtiedFunc(function () {
dirtied++;
});
console.assert(0 === dirtied, "0 === dirtied");
expect(dirtied).toBe(0);
// dirtied func MUST be called for the first time.
root_child0.markDirty();
expect(dirtied).toBe(1);
// dirtied func must NOT be called for the second time.
root_child0.markDirty();
expect(dirtied).toBe(1);
root.freeRecursive();
});
test("dirtied_hierarchy", function () {
const root = Yoga.Node.create();
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create();
root_child0.setAlignItems(Yoga.ALIGN_FLEX_START);
root_child0.setWidth(50);
root_child0.setHeight(20);
root_child0.setMeasureFunc(function () {});
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create();
root_child1.setAlignItems(Yoga.ALIGN_FLEX_START);
root_child1.setWidth(50);
root_child1.setHeight(20);
root_child1.setMeasureFunc(function () {});
root.insertChild(root_child1, 0);
root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
let dirtied = 0;
root_child0.setDirtiedFunc(function () {
dirtied++;
});
expect(dirtied).toBe(0);
// dirtied func must NOT be called for descendants.
// NOTE: nodes without a measure function cannot be marked dirty manually,
// but nodes with a measure function can not have children.
// Update the width to dirty the node instead.
root.setWidth(110);
console.assert(0 === dirtied, "0 === dirtied");
expect(dirtied).toBe(0);
// dirtied func MUST be called in case of explicit dirtying.
root_child0.markDirty();
console.assert(1 === dirtied, "1 === dirtied");
expect(dirtied).toBe(1);
if (typeof root !== "undefined")
root.freeRecursive();
typeof gc !== "undefined" && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});
it("dirtied_reset", function() {
test("dirtied_reset", function () {
const root = Yoga.Node.create();
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
root.setHeight(100);
root.setMeasureFunc(function() {});
root.setMeasureFunc(function () {});
root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
let dirtied = 0;
root.setDirtiedFunc(function() {
root.setDirtiedFunc(function () {
dirtied++;
});
console.assert(0 === dirtied, "0 === dirtied");
expect(dirtied).toBe(0);
// dirtied func MUST be called in case of explicit dirtying.
root.markDirty();
console.assert(1 === dirtied, "1 === dirtied");
expect(dirtied).toBe(1);
// recalculate so the root is no longer dirty
root.calculateLayout(undefined, undefined, Yoga.DIRECTION_LTR);
@@ -150,17 +142,13 @@ it("dirtied_reset", function() {
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
root.setHeight(100);
root.setMeasureFunc(function() {});
root.setMeasureFunc(function () {});
root.markDirty();
// dirtied func must NOT be called after reset.
root.markDirty();
console.assert(1 === dirtied, "1 === dirtied");
expect(dirtied).toBe(1);
if (typeof root !== "undefined")
root.freeRecursive();
typeof gc !== "undefined" && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
it("measure_once_single_flexible_child", function () {
test("measure_once_single_flexible_child", function () {
const root = Yoga.Node.create();
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_FLEX_START);
@@ -21,11 +21,7 @@ it("measure_once_single_flexible_child", function () {
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
console.assert(1 === measureCounter.get(), "1 === measureCounter.get()");
expect(measureCounter.get()).toBe(1);
if (typeof root !== "undefined")
root.freeRecursive();
(typeof gc !== "undefined") && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
it("dont_measure_single_grow_shrink_child", function () {
test("dont_measure_single_grow_shrink_child", function () {
const root = Yoga.Node.create();
root.setWidth(100);
root.setHeight(100);
@@ -19,11 +19,7 @@ it("dont_measure_single_grow_shrink_child", function () {
root.insertChild(root_child0, 0);
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
console.assert(0 === measureCounter.get(), "0 === measureCounter.get() (" + measureCounter.get() + ")");
expect(measureCounter.get()).toBe(0);
if (typeof root !== "undefined")
root.freeRecursive();
(typeof gc !== "undefined") && gc();
// TODO Add event support in js and check instace allocation and de allocation using that
root.freeRecursive();
});

View File

@@ -9,9 +9,10 @@
test("absolute_layout_width_height_start_top", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -55,9 +56,10 @@ test("absolute_layout_width_height_start_top", function () {
});
test("absolute_layout_width_height_end_bottom", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -101,9 +103,10 @@ test("absolute_layout_width_height_end_bottom", function () {
});
test("absolute_layout_start_top_end_bottom", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -147,9 +150,10 @@ test("absolute_layout_start_top_end_bottom", function () {
});
test("absolute_layout_width_height_start_top_end_bottom", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -195,9 +199,10 @@ test("absolute_layout_width_height_start_top_end_bottom", function () {
});
test("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setOverflow(Yoga.OVERFLOW_HIDDEN);
root.setWidth(50);
@@ -256,9 +261,10 @@ test("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_pare
});
test("absolute_layout_within_border", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setMargin(Yoga.EDGE_LEFT, 10);
root.setMargin(Yoga.EDGE_TOP, 10);
root.setMargin(Yoga.EDGE_RIGHT, 10);
@@ -376,9 +382,10 @@ test("absolute_layout_within_border", function () {
});
test("absolute_layout_align_items_and_justify_content_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexGrow(1);
@@ -423,9 +430,10 @@ test("absolute_layout_align_items_and_justify_content_center", function () {
});
test("absolute_layout_align_items_and_justify_content_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
root.setAlignItems(Yoga.ALIGN_FLEX_END);
root.setFlexGrow(1);
@@ -470,9 +478,10 @@ test("absolute_layout_align_items_and_justify_content_flex_end", function () {
});
test("absolute_layout_justify_content_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setFlexGrow(1);
root.setWidth(110);
@@ -516,9 +525,10 @@ test("absolute_layout_justify_content_center", function () {
});
test("absolute_layout_align_items_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexGrow(1);
root.setWidth(110);
@@ -562,9 +572,10 @@ test("absolute_layout_align_items_center", function () {
});
test("absolute_layout_align_items_center_on_child_only", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexGrow(1);
root.setWidth(110);
root.setHeight(100);
@@ -608,9 +619,10 @@ test("absolute_layout_align_items_center_on_child_only", function () {
});
test("absolute_layout_align_items_and_justify_content_center_and_top_position", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexGrow(1);
@@ -656,9 +668,10 @@ test("absolute_layout_align_items_and_justify_content_center_and_top_position",
});
test("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexGrow(1);
@@ -704,9 +717,10 @@ test("absolute_layout_align_items_and_justify_content_center_and_bottom_position
});
test("absolute_layout_align_items_and_justify_content_center_and_left_position", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexGrow(1);
@@ -752,9 +766,10 @@ test("absolute_layout_align_items_and_justify_content_center_and_left_position",
});
test("absolute_layout_align_items_and_justify_content_center_and_right_position", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexGrow(1);
@@ -800,9 +815,10 @@ test("absolute_layout_align_items_and_justify_content_center_and_right_position"
});
test("position_root_with_rtl_should_position_withoutdirection", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setPosition(Yoga.EDGE_LEFT, 72);
root.setWidth(52);
root.setHeight(52);
@@ -829,9 +845,10 @@ test("position_root_with_rtl_should_position_withoutdirection", function () {
});
test("absolute_layout_percentage_bottom_based_on_parent_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(200);
@@ -908,9 +925,10 @@ test("absolute_layout_percentage_bottom_based_on_parent_height", function () {
});
test("absolute_layout_in_wrap_reverse_column_container", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
root.setWidth(100);
root.setHeight(100);
@@ -953,9 +971,10 @@ test("absolute_layout_in_wrap_reverse_column_container", function () {
});
test("absolute_layout_in_wrap_reverse_row_container", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
root.setWidth(100);
@@ -999,9 +1018,10 @@ test("absolute_layout_in_wrap_reverse_row_container", function () {
});
test("absolute_layout_in_wrap_reverse_column_container_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
root.setWidth(100);
root.setHeight(100);
@@ -1045,9 +1065,10 @@ test("absolute_layout_in_wrap_reverse_column_container_flex_end", function () {
});
test("absolute_layout_in_wrap_reverse_row_container_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
root.setWidth(100);

View File

@@ -9,9 +9,10 @@
test("align_content_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(130);
@@ -114,9 +115,10 @@ test("align_content_flex_start", function () {
});
test("align_content_flex_start_without_height_on_children", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
root.setHeight(100);
@@ -215,9 +217,10 @@ test("align_content_flex_start_without_height_on_children", function () {
});
test("align_content_flex_start_with_flex", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
root.setHeight(120);
@@ -322,9 +325,10 @@ test("align_content_flex_start_with_flex", function () {
});
test("align_content_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignContent(Yoga.ALIGN_FLEX_END);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
@@ -427,9 +431,10 @@ test("align_content_flex_end", function () {
});
test("align_content_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(150);
@@ -527,9 +532,10 @@ test("align_content_stretch", function () {
});
test("align_content_spacebetween", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_SPACE_BETWEEN);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -633,9 +639,10 @@ test("align_content_spacebetween", function () {
});
test("align_content_spacearound", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_SPACE_AROUND);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -739,9 +746,10 @@ test("align_content_spacearound", function () {
});
test("align_content_stretch_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -840,9 +848,10 @@ test("align_content_stretch_row", function () {
});
test("align_content_stretch_row_with_children", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -957,9 +966,10 @@ test("align_content_stretch_row_with_children", function () {
});
test("align_content_stretch_row_with_flex", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1064,9 +1074,10 @@ test("align_content_stretch_row_with_flex", function () {
});
test("align_content_stretch_row_with_flex_no_shrink", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1170,9 +1181,10 @@ test("align_content_stretch_row_with_flex_no_shrink", function () {
});
test("align_content_stretch_row_with_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1279,9 +1291,10 @@ test("align_content_stretch_row_with_margin", function () {
});
test("align_content_stretch_row_with_padding", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1388,9 +1401,10 @@ test("align_content_stretch_row_with_padding", function () {
});
test("align_content_stretch_row_with_single_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1447,9 +1461,10 @@ test("align_content_stretch_row_with_single_row", function () {
});
test("align_content_stretch_row_with_fixed_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1549,9 +1564,10 @@ test("align_content_stretch_row_with_fixed_height", function () {
});
test("align_content_stretch_row_with_max_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1651,9 +1667,10 @@ test("align_content_stretch_row_with_max_height", function () {
});
test("align_content_stretch_row_with_min_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1753,9 +1770,10 @@ test("align_content_stretch_row_with_min_height", function () {
});
test("align_content_stretch_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
@@ -1872,9 +1890,10 @@ test("align_content_stretch_column", function () {
});
test("align_content_stretch_is_not_overriding_align_items", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignContent(Yoga.ALIGN_STRETCH);
const root_child0 = Yoga.Node.create(config);

View File

@@ -9,9 +9,10 @@
test("align_items_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -51,9 +52,10 @@ test("align_items_stretch", function () {
});
test("align_items_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(100);
root.setHeight(100);
@@ -95,9 +97,10 @@ test("align_items_center", function () {
});
test("align_items_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
root.setHeight(100);
@@ -139,9 +142,10 @@ test("align_items_flex_start", function () {
});
test("align_items_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_FLEX_END);
root.setWidth(100);
root.setHeight(100);
@@ -183,9 +187,10 @@ test("align_items_flex_end", function () {
});
test("align_baseline", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -243,9 +248,10 @@ test("align_baseline", function () {
});
test("align_baseline_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -318,9 +324,10 @@ test("align_baseline_child", function () {
});
test("align_baseline_child_multiline", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -440,9 +447,10 @@ test("align_baseline_child_multiline", function () {
});
test("align_baseline_child_multiline_override", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -564,9 +572,10 @@ test("align_baseline_child_multiline_override", function () {
});
test("align_baseline_child_multiline_no_override_on_secondline", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -687,9 +696,10 @@ test("align_baseline_child_multiline_no_override_on_secondline", function () {
});
test("align_baseline_child_top", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -763,9 +773,10 @@ test("align_baseline_child_top", function () {
});
test("align_baseline_child_top2", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -839,9 +850,10 @@ test("align_baseline_child_top2", function () {
});
test("align_baseline_double_nested_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -929,9 +941,10 @@ test("align_baseline_double_nested_child", function () {
});
test("align_baseline_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
root.setHeight(100);
@@ -988,9 +1001,10 @@ test("align_baseline_column", function () {
});
test("align_baseline_child_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setWidth(100);
@@ -1071,9 +1085,10 @@ test("align_baseline_child_margin", function () {
});
test("align_baseline_child_padding", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setPadding(Yoga.EDGE_LEFT, 5);
@@ -1154,9 +1169,10 @@ test("align_baseline_child_padding", function () {
});
test("align_baseline_multiline", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1275,9 +1291,10 @@ test("align_baseline_multiline", function () {
});
test("align_baseline_multiline_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
@@ -1361,7 +1378,7 @@ test("align_baseline_multiline_column", function () {
expect(root_child0.getComputedWidth()).toBe(50);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(70);
expect(root_child1.getComputedLeft()).toBe(50);
expect(root_child1.getComputedTop()).toBe(50);
expect(root_child1.getComputedWidth()).toBe(30);
expect(root_child1.getComputedHeight()).toBe(50);
@@ -1371,7 +1388,7 @@ test("align_baseline_multiline_column", function () {
expect(root_child1_child0.getComputedWidth()).toBe(20);
expect(root_child1_child0.getComputedHeight()).toBe(20);
expect(root_child2.getComputedLeft()).toBe(10);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(40);
expect(root_child2.getComputedHeight()).toBe(70);
@@ -1395,9 +1412,10 @@ test("align_baseline_multiline_column", function () {
});
test("align_baseline_multiline_column2", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
@@ -1481,7 +1499,7 @@ test("align_baseline_multiline_column2", function () {
expect(root_child0.getComputedWidth()).toBe(50);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(70);
expect(root_child1.getComputedLeft()).toBe(50);
expect(root_child1.getComputedTop()).toBe(50);
expect(root_child1.getComputedWidth()).toBe(30);
expect(root_child1.getComputedHeight()).toBe(50);
@@ -1491,7 +1509,7 @@ test("align_baseline_multiline_column2", function () {
expect(root_child1_child0.getComputedWidth()).toBe(20);
expect(root_child1_child0.getComputedHeight()).toBe(20);
expect(root_child2.getComputedLeft()).toBe(10);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(40);
expect(root_child2.getComputedHeight()).toBe(70);
@@ -1515,9 +1533,10 @@ test("align_baseline_multiline_column2", function () {
});
test("align_baseline_multiline_row_and_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_BASELINE);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1636,9 +1655,10 @@ test("align_baseline_multiline_row_and_column", function () {
});
test("align_items_center_child_with_margin_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(52);
@@ -1697,9 +1717,10 @@ test("align_items_center_child_with_margin_bigger_than_parent", function () {
});
test("align_items_flex_end_child_with_margin_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(52);
@@ -1758,9 +1779,10 @@ test("align_items_flex_end_child_with_margin_bigger_than_parent", function () {
});
test("align_items_center_child_without_margin_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(52);
@@ -1817,9 +1839,10 @@ test("align_items_center_child_without_margin_bigger_than_parent", function () {
});
test("align_items_flex_end_child_without_margin_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(52);
@@ -1876,9 +1899,10 @@ test("align_items_flex_end_child_without_margin_bigger_than_parent", function ()
});
test("align_center_should_size_based_on_content", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setMargin(Yoga.EDGE_TOP, 20);
root.setWidth(100);
@@ -1951,9 +1975,10 @@ test("align_center_should_size_based_on_content", function () {
});
test("align_stretch_should_size_based_on_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setMargin(Yoga.EDGE_TOP, 20);
root.setWidth(100);
root.setHeight(100);
@@ -2025,9 +2050,10 @@ test("align_stretch_should_size_based_on_parent", function () {
});
test("align_flex_start_with_shrinking_children", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(500);
root.setHeight(500);
@@ -2097,9 +2123,10 @@ test("align_flex_start_with_shrinking_children", function () {
});
test("align_flex_start_with_stretching_children", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(500);
root.setHeight(500);
@@ -2168,9 +2195,10 @@ test("align_flex_start_with_stretching_children", function () {
});
test("align_flex_start_with_shrinking_children_with_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(500);
root.setHeight(500);

View File

@@ -9,9 +9,10 @@
test("align_self_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -53,9 +54,10 @@ test("align_self_center", function () {
});
test("align_self_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -97,9 +99,10 @@ test("align_self_flex_end", function () {
});
test("align_self_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -141,9 +144,10 @@ test("align_self_flex_start", function () {
});
test("align_self_flex_end_override_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
root.setHeight(100);
@@ -186,9 +190,10 @@ test("align_self_flex_end_override_flex_start", function () {
});
test("align_self_baseline", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);

View File

@@ -9,9 +9,10 @@
test("android_news_feed", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setWidth(1080);

View File

@@ -9,9 +9,10 @@
test("border_no_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setBorder(Yoga.EDGE_LEFT, 10);
root.setBorder(Yoga.EDGE_TOP, 10);
root.setBorder(Yoga.EDGE_RIGHT, 10);
@@ -39,9 +40,10 @@ test("border_no_size", function () {
});
test("border_container_match_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setBorder(Yoga.EDGE_LEFT, 10);
root.setBorder(Yoga.EDGE_TOP, 10);
root.setBorder(Yoga.EDGE_RIGHT, 10);
@@ -84,9 +86,10 @@ test("border_container_match_child", function () {
});
test("border_flex_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setBorder(Yoga.EDGE_LEFT, 10);
root.setBorder(Yoga.EDGE_TOP, 10);
root.setBorder(Yoga.EDGE_RIGHT, 10);
@@ -131,9 +134,10 @@ test("border_flex_child", function () {
});
test("border_stretch_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setBorder(Yoga.EDGE_LEFT, 10);
root.setBorder(Yoga.EDGE_TOP, 10);
root.setBorder(Yoga.EDGE_RIGHT, 10);
@@ -177,9 +181,10 @@ test("border_stretch_child", function () {
});
test("border_center_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setBorder(Yoga.EDGE_START, 10);

View File

@@ -9,9 +9,10 @@
test("wrap_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth(100);
@@ -50,9 +51,10 @@ test("wrap_child", function () {
});
test("wrap_grandchild", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
const root_child0 = Yoga.Node.create(config);
root.insertChild(root_child0, 0);

View File

@@ -9,9 +9,10 @@
test("display_none", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -67,9 +68,10 @@ test("display_none", function () {
});
test("display_none_fixed_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -126,9 +128,10 @@ test("display_none_fixed_size", function () {
});
test("display_none_with_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -189,9 +192,10 @@ test("display_none_with_margin", function () {
});
test("display_none_with_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -284,9 +288,10 @@ test("display_none_with_child", function () {
});
test("display_none_with_position", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -343,9 +348,10 @@ test("display_none_with_position", function () {
});
test("display_none_with_position_absolute", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);

View File

@@ -9,9 +9,10 @@
test("flex_direction_column_no_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
const root_child0 = Yoga.Node.create(config);
@@ -78,9 +79,10 @@ test("flex_direction_column_no_height", function () {
});
test("flex_direction_row_no_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setHeight(100);
@@ -148,9 +150,10 @@ test("flex_direction_row_no_width", function () {
});
test("flex_direction_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -218,9 +221,10 @@ test("flex_direction_column", function () {
});
test("flex_direction_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -289,9 +293,10 @@ test("flex_direction_row", function () {
});
test("flex_direction_column_reverse", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN_REVERSE);
root.setWidth(100);
root.setHeight(100);
@@ -360,9 +365,10 @@ test("flex_direction_column_reverse", function () {
});
test("flex_direction_row_reverse", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW_REVERSE);
root.setWidth(100);
root.setHeight(100);

View File

@@ -9,9 +9,10 @@
test("flex_basis_flex_grow_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -66,9 +67,10 @@ test("flex_basis_flex_grow_column", function () {
});
test("flex_shrink_flex_grow_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(500);
root.setHeight(500);
@@ -127,9 +129,10 @@ test("flex_shrink_flex_grow_row", function () {
});
test("flex_shrink_flex_grow_child_flex_shrink_other_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(500);
root.setHeight(500);
@@ -189,9 +192,10 @@ test("flex_shrink_flex_grow_child_flex_shrink_other_child", function () {
});
test("flex_basis_flex_grow_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -247,9 +251,10 @@ test("flex_basis_flex_grow_row", function () {
});
test("flex_basis_flex_shrink_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -304,9 +309,10 @@ test("flex_basis_flex_shrink_column", function () {
});
test("flex_basis_flex_shrink_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -362,9 +368,10 @@ test("flex_basis_flex_shrink_row", function () {
});
test("flex_shrink_to_zero", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setHeight(75);
const root_child0 = Yoga.Node.create(config);
@@ -435,9 +442,10 @@ test("flex_shrink_to_zero", function () {
});
test("flex_basis_overrides_main_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -509,9 +517,10 @@ test("flex_basis_overrides_main_size", function () {
});
test("flex_grow_shrink_at_most", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -565,9 +574,10 @@ test("flex_grow_shrink_at_most", function () {
});
test("flex_grow_less_than_factor_one", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(500);

View File

@@ -9,9 +9,10 @@
test("wrap_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setHeight(100);
@@ -97,9 +98,10 @@ test("wrap_column", function () {
});
test("wrap_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
@@ -186,9 +188,10 @@ test("wrap_row", function () {
});
test("wrap_row_align_items_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_FLEX_END);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -276,9 +279,10 @@ test("wrap_row_align_items_flex_end", function () {
});
test("wrap_row_align_items_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -366,9 +370,10 @@ test("wrap_row_align_items_center", function () {
});
test("flex_wrap_children_with_min_main_overriding_flex_basis", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
@@ -427,9 +432,10 @@ test("flex_wrap_children_with_min_main_overriding_flex_basis", function () {
});
test("flex_wrap_wrap_to_child_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
const root_child0 = Yoga.Node.create(config);
root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
@@ -513,9 +519,10 @@ test("flex_wrap_wrap_to_child_height", function () {
});
test("flex_wrap_align_stretch_fits_one_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(150);
@@ -571,9 +578,10 @@ test("flex_wrap_align_stretch_fits_one_row", function () {
});
test("wrap_reverse_row_align_content_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
root.setWidth(100);
@@ -675,9 +683,10 @@ test("wrap_reverse_row_align_content_flex_start", function () {
});
test("wrap_reverse_row_align_content_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_CENTER);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
@@ -780,9 +789,10 @@ test("wrap_reverse_row_align_content_center", function () {
});
test("wrap_reverse_row_single_line_different_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
root.setWidth(300);
@@ -884,9 +894,10 @@ test("wrap_reverse_row_single_line_different_size", function () {
});
test("wrap_reverse_row_align_content_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
@@ -989,9 +1000,10 @@ test("wrap_reverse_row_align_content_stretch", function () {
});
test("wrap_reverse_row_align_content_space_around", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_SPACE_AROUND);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
@@ -1094,9 +1106,10 @@ test("wrap_reverse_row_align_content_space_around", function () {
});
test("wrap_reverse_column_fixed_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
root.setWidth(200);
@@ -1199,9 +1212,10 @@ test("wrap_reverse_column_fixed_size", function () {
});
test("wrapped_row_within_align_items_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -1273,9 +1287,10 @@ test("wrapped_row_within_align_items_center", function () {
});
test("wrapped_row_within_align_items_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(200);
root.setHeight(200);
@@ -1347,9 +1362,10 @@ test("wrapped_row_within_align_items_flex_start", function () {
});
test("wrapped_row_within_align_items_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_FLEX_END);
root.setWidth(200);
root.setHeight(200);
@@ -1421,9 +1437,10 @@ test("wrapped_row_within_align_items_flex_end", function () {
});
test("wrapped_column_max_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignContent(Yoga.ALIGN_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
@@ -1503,9 +1520,10 @@ test("wrapped_column_max_height", function () {
});
test("wrapped_column_max_height_flex", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignContent(Yoga.ALIGN_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
@@ -1591,9 +1609,10 @@ test("wrapped_column_max_height_flex", function () {
});
test("wrap_nodes_with_content_sizing_overflowing_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(500);
root.setHeight(500);
@@ -1692,9 +1711,10 @@ test("wrap_nodes_with_content_sizing_overflowing_margin", function () {
});
test("wrap_nodes_with_content_sizing_margin_cross", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(500);
root.setHeight(500);

View File

@@ -9,9 +9,10 @@
test("column_gap_flexible", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(80);
root.setHeight(100);
@@ -88,9 +89,10 @@ test("column_gap_flexible", function () {
});
test("column_gap_inflexible", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(80);
root.setHeight(100);
@@ -160,9 +162,10 @@ test("column_gap_inflexible", function () {
});
test("column_gap_mixed_flexible", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(80);
root.setHeight(100);
@@ -234,9 +237,10 @@ test("column_gap_mixed_flexible", function () {
});
test("column_gap_child_margins", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(80);
root.setHeight(100);
@@ -318,9 +322,10 @@ test("column_gap_child_margins", function () {
});
test("column_row_gap_wrapping", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(80);
@@ -484,9 +489,10 @@ test("column_row_gap_wrapping", function () {
});
test("column_gap_justify_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -556,9 +562,10 @@ test("column_gap_justify_flex_start", function () {
});
test("column_gap_justify_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(100);
@@ -629,9 +636,10 @@ test("column_gap_justify_center", function () {
});
test("column_gap_justify_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
root.setWidth(100);
@@ -702,9 +710,10 @@ test("column_gap_justify_flex_end", function () {
});
test("column_gap_justify_space_between", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN);
root.setWidth(100);
@@ -775,9 +784,10 @@ test("column_gap_justify_space_between", function () {
});
test("column_gap_justify_space_around", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND);
root.setWidth(100);
@@ -848,9 +858,10 @@ test("column_gap_justify_space_around", function () {
});
test("column_gap_justify_space_evenly", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY);
root.setWidth(100);
@@ -921,9 +932,10 @@ test("column_gap_justify_space_evenly", function () {
});
test("column_gap_wrap_align_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);
@@ -1043,9 +1055,10 @@ test("column_gap_wrap_align_flex_start", function () {
});
test("column_gap_wrap_align_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_CENTER);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1166,9 +1179,10 @@ test("column_gap_wrap_align_center", function () {
});
test("column_gap_wrap_align_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_FLEX_END);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1289,9 +1303,10 @@ test("column_gap_wrap_align_flex_end", function () {
});
test("column_gap_wrap_align_space_between", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_SPACE_BETWEEN);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1412,9 +1427,10 @@ test("column_gap_wrap_align_space_between", function () {
});
test("column_gap_wrap_align_space_around", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_SPACE_AROUND);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1535,9 +1551,10 @@ test("column_gap_wrap_align_space_around", function () {
});
test("column_gap_wrap_align_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1642,9 +1659,10 @@ test("column_gap_wrap_align_stretch", function () {
});
test("row_gap_align_items_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1759,9 +1777,10 @@ test("row_gap_align_items_stretch", function () {
});
test("row_gap_align_items_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_FLEX_END);
root.setFlexWrap(Yoga.WRAP_WRAP);
@@ -1876,9 +1895,10 @@ test("row_gap_align_items_end", function () {
});
test("row_gap_column_child_margins", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(200);
root.setGap(Yoga.GUTTER_ROW, 10);
@@ -1959,9 +1979,10 @@ test("row_gap_column_child_margins", function () {
});
test("row_gap_row_wrap_child_margins", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setFlexWrap(Yoga.WRAP_WRAP);
root.setWidth(100);

View File

@@ -9,9 +9,10 @@
test("justify_content_row_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(102);
root.setHeight(102);
@@ -80,9 +81,10 @@ test("justify_content_row_flex_start", function () {
});
test("justify_content_row_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
root.setWidth(102);
@@ -152,9 +154,10 @@ test("justify_content_row_flex_end", function () {
});
test("justify_content_row_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(102);
@@ -224,9 +227,10 @@ test("justify_content_row_center", function () {
});
test("justify_content_row_space_between", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN);
root.setWidth(102);
@@ -296,9 +300,10 @@ test("justify_content_row_space_between", function () {
});
test("justify_content_row_space_around", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND);
root.setWidth(102);
@@ -368,9 +373,10 @@ test("justify_content_row_space_around", function () {
});
test("justify_content_column_flex_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(102);
root.setHeight(102);
@@ -438,9 +444,10 @@ test("justify_content_column_flex_start", function () {
});
test("justify_content_column_flex_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
root.setWidth(102);
root.setHeight(102);
@@ -509,9 +516,10 @@ test("justify_content_column_flex_end", function () {
});
test("justify_content_column_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(102);
root.setHeight(102);
@@ -580,9 +588,10 @@ test("justify_content_column_center", function () {
});
test("justify_content_column_space_between", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN);
root.setWidth(102);
root.setHeight(102);
@@ -651,9 +660,10 @@ test("justify_content_column_space_between", function () {
});
test("justify_content_column_space_around", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND);
root.setWidth(102);
root.setHeight(102);
@@ -722,9 +732,10 @@ test("justify_content_column_space_around", function () {
});
test("justify_content_row_min_width_and_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setMargin(Yoga.EDGE_LEFT, 100);
@@ -767,9 +778,10 @@ test("justify_content_row_min_width_and_margin", function () {
});
test("justify_content_row_max_width_and_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setMargin(Yoga.EDGE_LEFT, 100);
@@ -813,9 +825,10 @@ test("justify_content_row_max_width_and_margin", function () {
});
test("justify_content_column_min_height_and_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setMargin(Yoga.EDGE_TOP, 100);
root.setMinHeight(50);
@@ -857,9 +870,10 @@ test("justify_content_column_min_height_and_margin", function () {
});
test("justify_content_colunn_max_height_and_margin", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setMargin(Yoga.EDGE_TOP, 100);
root.setHeight(100);
@@ -902,9 +916,10 @@ test("justify_content_colunn_max_height_and_margin", function () {
});
test("justify_content_column_space_evenly", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY);
root.setWidth(102);
root.setHeight(102);
@@ -973,9 +988,10 @@ test("justify_content_column_space_evenly", function () {
});
test("justify_content_row_space_evenly", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY);
root.setWidth(102);
@@ -1045,9 +1061,10 @@ test("justify_content_row_space_evenly", function () {
});
test("justify_content_min_width_with_padding_child_width_greater_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setWidth(1000);
root.setHeight(1584);
@@ -1125,9 +1142,10 @@ test("justify_content_min_width_with_padding_child_width_greater_than_parent", f
});
test("justify_content_min_width_with_padding_child_width_lower_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignContent(Yoga.ALIGN_STRETCH);
root.setWidth(1080);
root.setHeight(1584);

View File

@@ -9,9 +9,10 @@
test("margin_start", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -53,9 +54,10 @@ test("margin_start", function () {
});
test("margin_top", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -96,9 +98,10 @@ test("margin_top", function () {
});
test("margin_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
root.setWidth(100);
@@ -141,9 +144,10 @@ test("margin_end", function () {
});
test("margin_bottom", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
root.setWidth(100);
root.setHeight(100);
@@ -185,9 +189,10 @@ test("margin_bottom", function () {
});
test("margin_and_flex_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -230,9 +235,10 @@ test("margin_and_flex_row", function () {
});
test("margin_and_flex_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -274,9 +280,10 @@ test("margin_and_flex_column", function () {
});
test("margin_and_stretch_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -319,9 +326,10 @@ test("margin_and_stretch_row", function () {
});
test("margin_and_stretch_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -363,9 +371,10 @@ test("margin_and_stretch_column", function () {
});
test("margin_with_sibling_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -421,9 +430,10 @@ test("margin_with_sibling_row", function () {
});
test("margin_with_sibling_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -478,9 +488,10 @@ test("margin_with_sibling_column", function () {
});
test("margin_auto_bottom", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -538,9 +549,10 @@ test("margin_auto_bottom", function () {
});
test("margin_auto_top", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -598,9 +610,10 @@ test("margin_auto_top", function () {
});
test("margin_auto_bottom_and_top", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -659,9 +672,10 @@ test("margin_auto_bottom_and_top", function () {
});
test("margin_auto_bottom_and_top_justify_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -720,9 +734,10 @@ test("margin_auto_bottom_and_top_justify_center", function () {
});
test("margin_auto_mutiple_children_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -796,9 +811,10 @@ test("margin_auto_mutiple_children_column", function () {
});
test("margin_auto_mutiple_children_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
@@ -873,9 +889,10 @@ test("margin_auto_mutiple_children_row", function () {
});
test("margin_auto_left_and_right_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
@@ -935,9 +952,10 @@ test("margin_auto_left_and_right_column", function () {
});
test("margin_auto_left_and_right", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -995,9 +1013,10 @@ test("margin_auto_left_and_right", function () {
});
test("margin_auto_start_and_end_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
@@ -1057,9 +1076,10 @@ test("margin_auto_start_and_end_column", function () {
});
test("margin_auto_start_and_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -1117,9 +1137,10 @@ test("margin_auto_start_and_end", function () {
});
test("margin_auto_left_and_right_column_and_center", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -1178,9 +1199,10 @@ test("margin_auto_left_and_right_column_and_center", function () {
});
test("margin_auto_left", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -1238,9 +1260,10 @@ test("margin_auto_left", function () {
});
test("margin_auto_right", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -1298,9 +1321,10 @@ test("margin_auto_right", function () {
});
test("margin_auto_left_and_right_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(200);
root.setHeight(200);
@@ -1359,9 +1383,10 @@ test("margin_auto_left_and_right_stretch", function () {
});
test("margin_auto_top_and_bottom_stretch", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -1419,9 +1444,10 @@ test("margin_auto_top_and_bottom_stretch", function () {
});
test("margin_should_not_be_part_of_max_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(250);
root.setHeight(250);
@@ -1464,9 +1490,10 @@ test("margin_should_not_be_part_of_max_height", function () {
});
test("margin_should_not_be_part_of_max_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(250);
root.setHeight(250);
@@ -1509,9 +1536,10 @@ test("margin_should_not_be_part_of_max_width", function () {
});
test("margin_auto_left_right_child_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(52);
root.setHeight(52);
@@ -1555,9 +1583,10 @@ test("margin_auto_left_right_child_bigger_than_parent", function () {
});
test("margin_auto_left_child_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(52);
root.setHeight(52);
@@ -1600,9 +1629,10 @@ test("margin_auto_left_child_bigger_than_parent", function () {
});
test("margin_fix_left_auto_right_child_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(52);
root.setHeight(52);
@@ -1646,9 +1676,10 @@ test("margin_fix_left_auto_right_child_bigger_than_parent", function () {
});
test("margin_auto_left_fix_right_child_bigger_than_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(52);
root.setHeight(52);
@@ -1692,9 +1723,10 @@ test("margin_auto_left_fix_right_child_bigger_than_parent", function () {
});
test("margin_auto_top_stretching_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
@@ -1753,9 +1785,10 @@ test("margin_auto_top_stretching_child", function () {
});
test("margin_auto_left_stretching_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);

View File

@@ -9,9 +9,10 @@
test("max_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -52,9 +53,10 @@ test("max_width", function () {
});
test("max_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -96,9 +98,10 @@ test("max_height", function () {
});
test("justify_content_min_max", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setWidth(100);
root.setMinHeight(100);
@@ -141,9 +144,10 @@ test("justify_content_min_max", function () {
});
test("align_items_min_max", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setMinWidth(100);
root.setMaxWidth(200);
@@ -186,9 +190,10 @@ test("align_items_min_max", function () {
});
test("justify_content_overflow_min_max", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setMinHeight(100);
root.setMaxHeight(110);
@@ -260,9 +265,10 @@ test("justify_content_overflow_min_max", function () {
});
test("flex_grow_to_min", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setMinHeight(100);
root.setMaxHeight(500);
@@ -318,9 +324,10 @@ test("flex_grow_to_min", function () {
});
test("flex_grow_in_at_most_container", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
@@ -377,9 +384,10 @@ test("flex_grow_in_at_most_container", function () {
});
test("flex_grow_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
const root_child0 = Yoga.Node.create(config);
@@ -420,9 +428,10 @@ test("flex_grow_child", function () {
});
test("flex_grow_within_constrained_min_max_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setMinHeight(100);
root.setMaxHeight(200);
@@ -476,9 +485,10 @@ test("flex_grow_within_constrained_min_max_column", function () {
});
test("flex_grow_within_max_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(100);
@@ -534,9 +544,10 @@ test("flex_grow_within_max_width", function () {
});
test("flex_grow_within_constrained_max_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(100);
@@ -592,9 +603,10 @@ test("flex_grow_within_constrained_max_width", function () {
});
test("flex_root_ignored", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexGrow(1);
root.setWidth(100);
root.setMinHeight(100);
@@ -651,9 +663,10 @@ test("flex_root_ignored", function () {
});
test("flex_grow_root_minimized", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setMinHeight(100);
root.setMaxHeight(500);
@@ -725,9 +738,10 @@ test("flex_grow_root_minimized", function () {
});
test("flex_grow_height_maximized", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(500);
@@ -798,9 +812,10 @@ test("flex_grow_height_maximized", function () {
});
test("flex_grow_within_constrained_min_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setMinWidth(100);
root.setHeight(100);
@@ -855,9 +870,10 @@ test("flex_grow_within_constrained_min_row", function () {
});
test("flex_grow_within_constrained_min_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setMinHeight(100);
const root_child0 = Yoga.Node.create(config);
@@ -910,9 +926,10 @@ test("flex_grow_within_constrained_min_column", function () {
});
test("flex_grow_within_constrained_max_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
const root_child0 = Yoga.Node.create(config);
@@ -982,9 +999,10 @@ test("flex_grow_within_constrained_max_row", function () {
});
test("flex_grow_within_constrained_max_column", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setMaxHeight(100);
@@ -1039,9 +1057,10 @@ test("flex_grow_within_constrained_max_column", function () {
});
test("child_min_max_width_flexing", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(120);
root.setHeight(50);
@@ -1100,9 +1119,10 @@ test("child_min_max_width_flexing", function () {
});
test("min_width_overrides_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(50);
root.setMinWidth(100);
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
@@ -1128,9 +1148,10 @@ test("min_width_overrides_width", function () {
});
test("max_width_overrides_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setMaxWidth(100);
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
@@ -1156,9 +1177,10 @@ test("max_width_overrides_width", function () {
});
test("min_height_overrides_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setHeight(50);
root.setMinHeight(100);
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
@@ -1184,9 +1206,10 @@ test("min_height_overrides_height", function () {
});
test("max_height_overrides_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setHeight(200);
root.setMaxHeight(100);
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
@@ -1212,9 +1235,10 @@ test("max_height_overrides_height", function () {
});
test("min_max_percent_no_width_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setAlignItems(Yoga.ALIGN_FLEX_START);
root.setWidth(100);
root.setHeight(100);

View File

@@ -9,9 +9,10 @@
test("padding_no_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setPadding(Yoga.EDGE_LEFT, 10);
root.setPadding(Yoga.EDGE_TOP, 10);
root.setPadding(Yoga.EDGE_RIGHT, 10);
@@ -39,9 +40,10 @@ test("padding_no_size", function () {
});
test("padding_container_match_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setPadding(Yoga.EDGE_LEFT, 10);
root.setPadding(Yoga.EDGE_TOP, 10);
root.setPadding(Yoga.EDGE_RIGHT, 10);
@@ -84,9 +86,10 @@ test("padding_container_match_child", function () {
});
test("padding_flex_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setPadding(Yoga.EDGE_LEFT, 10);
root.setPadding(Yoga.EDGE_TOP, 10);
root.setPadding(Yoga.EDGE_RIGHT, 10);
@@ -131,9 +134,10 @@ test("padding_flex_child", function () {
});
test("padding_stretch_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setPadding(Yoga.EDGE_LEFT, 10);
root.setPadding(Yoga.EDGE_TOP, 10);
root.setPadding(Yoga.EDGE_RIGHT, 10);
@@ -177,9 +181,10 @@ test("padding_stretch_child", function () {
});
test("padding_center_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setPadding(Yoga.EDGE_START, 10);
@@ -225,9 +230,10 @@ test("padding_center_child", function () {
});
test("child_with_padding_align_end", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
root.setAlignItems(Yoga.ALIGN_FLEX_END);
root.setWidth(200);

View File

@@ -9,9 +9,10 @@
test("percentage_width_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(200);
root.setHeight(200);
@@ -53,9 +54,10 @@ test("percentage_width_height", function () {
});
test("percentage_position_left_top", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(400);
root.setHeight(400);
@@ -99,9 +101,10 @@ test("percentage_position_left_top", function () {
});
test("percentage_position_bottom_right", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(500);
root.setHeight(500);
@@ -145,9 +148,10 @@ test("percentage_position_bottom_right", function () {
});
test("percentage_flex_basis", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(200);
root.setHeight(200);
@@ -204,9 +208,10 @@ test("percentage_flex_basis", function () {
});
test("percentage_flex_basis_cross", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -262,9 +267,10 @@ test("percentage_flex_basis_cross", function () {
});
test("percentage_flex_basis_main_max_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(200);
root.setHeight(200);
@@ -323,9 +329,10 @@ test("percentage_flex_basis_main_max_height", function () {
});
test("percentage_flex_basis_cross_max_height", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -383,9 +390,10 @@ test("percentage_flex_basis_cross_max_height", function () {
});
test("percentage_flex_basis_main_max_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(200);
root.setHeight(200);
@@ -444,9 +452,10 @@ test("percentage_flex_basis_main_max_width", function () {
});
test("percentage_flex_basis_cross_max_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -504,9 +513,10 @@ test("percentage_flex_basis_cross_max_width", function () {
});
test("percentage_flex_basis_main_min_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(200);
root.setHeight(200);
@@ -565,9 +575,10 @@ test("percentage_flex_basis_main_min_width", function () {
});
test("percentage_flex_basis_cross_min_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -625,9 +636,10 @@ test("percentage_flex_basis_cross_min_width", function () {
});
test("percentage_multiple_nested_with_padding_margin_and_percentage_values", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(200);
@@ -737,9 +749,10 @@ test("percentage_multiple_nested_with_padding_margin_and_percentage_values", fun
});
test("percentage_margin_should_calculate_based_only_on_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(100);
@@ -798,9 +811,10 @@ test("percentage_margin_should_calculate_based_only_on_width", function () {
});
test("percentage_padding_should_calculate_based_only_on_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(100);
@@ -859,9 +873,10 @@ test("percentage_padding_should_calculate_based_only_on_width", function () {
});
test("percentage_absolute_position", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(200);
root.setHeight(100);
@@ -905,9 +920,10 @@ test("percentage_absolute_position", function () {
});
test("percentage_width_height_undefined_parent_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth("50%");
@@ -946,9 +962,10 @@ test("percentage_width_height_undefined_parent_size", function () {
});
test("percent_within_flex_grow", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(350);
root.setHeight(100);
@@ -1031,9 +1048,10 @@ test("percent_within_flex_grow", function () {
});
test("percentage_container_in_wrapping_container", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
@@ -1120,9 +1138,10 @@ test("percentage_container_in_wrapping_container", function () {
});
test("percent_absolute_position", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(60);
root.setHeight(50);

View File

@@ -9,9 +9,10 @@
test("rounding_flex_basis_flex_grow_row_width_of_100", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(100);
root.setHeight(100);
@@ -80,9 +81,10 @@ test("rounding_flex_basis_flex_grow_row_width_of_100", function () {
});
test("rounding_flex_basis_flex_grow_row_prime_number_width", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(113);
root.setHeight(100);
@@ -179,9 +181,10 @@ test("rounding_flex_basis_flex_grow_row_prime_number_width", function () {
});
test("rounding_flex_basis_flex_shrink_row", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(101);
root.setHeight(100);
@@ -251,9 +254,10 @@ test("rounding_flex_basis_flex_shrink_row", function () {
});
test("rounding_flex_basis_overrides_main_size", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(113);
@@ -325,9 +329,10 @@ test("rounding_flex_basis_overrides_main_size", function () {
});
test("rounding_total_fractial", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(87.4);
root.setHeight(113.4);
@@ -399,9 +404,10 @@ test("rounding_total_fractial", function () {
});
test("rounding_total_fractial_nested", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(87.4);
root.setHeight(113.4);
@@ -507,9 +513,10 @@ test("rounding_total_fractial_nested", function () {
});
test("rounding_fractial_input_1", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(113.4);
@@ -581,9 +588,10 @@ test("rounding_fractial_input_1", function () {
});
test("rounding_fractial_input_2", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(113.6);
@@ -655,9 +663,10 @@ test("rounding_fractial_input_2", function () {
});
test("rounding_fractial_input_3", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setPosition(Yoga.EDGE_TOP, 0.3);
root.setWidth(100);
root.setHeight(113.4);
@@ -730,9 +739,10 @@ test("rounding_fractial_input_3", function () {
});
test("rounding_fractial_input_4", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setPosition(Yoga.EDGE_TOP, 0.7);
root.setWidth(100);
root.setHeight(113.4);
@@ -805,9 +815,10 @@ test("rounding_fractial_input_4", function () {
});
test("rounding_inner_node_controversy_horizontal", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(320);
@@ -893,9 +904,10 @@ test("rounding_inner_node_controversy_horizontal", function () {
});
test("rounding_inner_node_controversy_vertical", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setHeight(320);
const root_child0 = Yoga.Node.create(config);
@@ -980,9 +992,10 @@ test("rounding_inner_node_controversy_vertical", function () {
});
test("rounding_inner_node_controversy_combined", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root.setWidth(640);
root.setHeight(320);

View File

@@ -9,9 +9,10 @@
test("nested_overflowing_child", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -65,9 +66,10 @@ test("nested_overflowing_child", function () {
});
test("nested_overflowing_child_in_constraint_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);
@@ -123,9 +125,10 @@ test("nested_overflowing_child_in_constraint_parent", function () {
});
test("parent_wrap_child_size_overflowing_parent", function () {
const config = Yoga.Config.create();
let root;
try {
const root = Yoga.Node.create(config);
root = Yoga.Node.create(config);
root.setWidth(100);
root.setHeight(100);

View File

@@ -16,19 +16,21 @@ let vm = require(`vm`);
let WARMUP_ITERATIONS = 3;
let BENCHMARK_ITERATIONS = 10;
let testFiles = process.argv.slice(2).map(file => {
let testFiles = process.argv.slice(2).map((file) => {
return fs.readFileSync(file).toString();
});
let testResults = new Map();
for (let type of ['asmjs', 'wasm']) {
for (let type of ["asmjs", "wasm"]) {
for (let file of testFiles) {
vm.runInNewContext(
file,
Object.assign(Object.create(global), {
Yoga: require(type === 'asmjs' ? '../dist/entrypoint/asmjs-sync' : '../dist/entrypoint/wasm-sync'),
YGBENCHMARK: function(name, fn) {
Yoga: require(type === "asmjs"
? "../dist/entrypoint/asmjs-sync"
: "../dist/entrypoint/wasm-sync"),
YGBENCHMARK: function (name, fn) {
let testEntry = testResults.get(name);
if (testEntry === undefined)
@@ -44,13 +46,13 @@ for (let type of ['asmjs', 'wasm']) {
testEntry.set(type, (end - start) / BENCHMARK_ITERATIONS);
},
}),
})
);
}
}
console.log(
`Note: those tests are independants; there is no time relation to be expected between them`,
`Note: those tests are independants; there is no time relation to be expected between them`
);
for (let [name, results] of testResults) {
@@ -62,7 +64,7 @@ for (let [name, results] of testResults) {
for (let [type, result] of results) {
console.log(
` - ${type}: ${result}ms (${Math.round((result / min) * 10000) / 100}%)`,
` - ${type}: ${result}ms (${Math.round((result / min) * 10000) / 100}%)`
);
}
}

View File

@@ -7,59 +7,54 @@
* @format
*/
var target = typeof global !== 'undefined' ? global : window;
target.getMeasureCounter = function(Yoga, cb, staticWidth, staticHeight) {
global.getMeasureCounter = function (Yoga, cb, staticWidth, staticHeight) {
var counter = 0;
return {
inc: function(width, widthMode, height, heightMode) {
inc: function (width, widthMode, height, heightMode) {
counter += 1;
return cb
? cb(width, widthMode, height, heightMode)
: {width: staticWidth, height: staticHeight};
: { width: staticWidth, height: staticHeight };
},
get: function() {
get: function () {
return counter;
},
};
};
target.getMeasureCounterMax = function(Yoga) {
return getMeasureCounter(Yoga, function(
width,
widthMode,
height,
heightMode,
) {
var measuredWidth = widthMode === Yoga.MEASURE_MODE_UNDEFINED ? 10 : width;
var measuredHeight =
heightMode === Yoga.MEASURE_MODE_UNDEFINED ? 10 : height;
global.getMeasureCounterMax = function (Yoga) {
return getMeasureCounter(
Yoga,
function (width, widthMode, height, heightMode) {
var measuredWidth =
widthMode === Yoga.MEASURE_MODE_UNDEFINED ? 10 : width;
var measuredHeight =
heightMode === Yoga.MEASURE_MODE_UNDEFINED ? 10 : height;
return {width: measuredWidth, height: measuredHeight};
});
return { width: measuredWidth, height: measuredHeight };
}
);
};
target.getMeasureCounterMin = function(Yoga) {
return getMeasureCounter(Yoga, function(
width,
widthMode,
height,
heightMode,
) {
var measuredWidth =
widthMode === Yoga.MEASURE_MODE_UNDEFINED ||
(widthMode == Yoga.MEASURE_MODE_AT_MOST && width > 10)
? 10
: width;
var measuredHeight =
heightMode === Yoga.MEASURE_MODE_UNDEFINED ||
(heightMode == Yoga.MEASURE_MODE_AT_MOST && height > 10)
? 10
: height;
global.getMeasureCounterMin = function (Yoga) {
return getMeasureCounter(
Yoga,
function (width, widthMode, height, heightMode) {
var measuredWidth =
widthMode === Yoga.MEASURE_MODE_UNDEFINED ||
(widthMode == Yoga.MEASURE_MODE_AT_MOST && width > 10)
? 10
: width;
var measuredHeight =
heightMode === Yoga.MEASURE_MODE_UNDEFINED ||
(heightMode == Yoga.MEASURE_MODE_AT_MOST && height > 10)
? 10
: height;
return {width: measuredWidth, height: measuredHeight};
});
return { width: measuredWidth, height: measuredHeight };
}
);
};