Move generated Jest tests to TypeScript #1287
@@ -1266,6 +1266,7 @@ namespace Facebook.Yoga
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void Test_align_baseline_multiline_column()
|
||||
{
|
||||
YogaConfig config = new YogaConfig();
|
||||
@@ -1358,7 +1359,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(70f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(30f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||
@@ -1368,7 +1369,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(20f, root_child1_child0.LayoutWidth);
|
||||
Assert.AreEqual(20f, root_child1_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(10f, root_child2.LayoutX);
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||
Assert.AreEqual(40f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(70f, root_child2.LayoutHeight);
|
||||
@@ -1385,6 +1386,7 @@ namespace Facebook.Yoga
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void Test_align_baseline_multiline_column2()
|
||||
{
|
||||
YogaConfig config = new YogaConfig();
|
||||
@@ -1477,7 +1479,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(70f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(30f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||
@@ -1487,7 +1489,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(20f, root_child1_child0.LayoutWidth);
|
||||
Assert.AreEqual(20f, root_child1_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(10f, root_child2.LayoutX);
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||
Assert.AreEqual(40f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(70f, root_child2.LayoutHeight);
|
||||
|
@@ -100,6 +100,121 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void Test_min_height()
|
||||
{
|
||||
YogaConfig config = new YogaConfig();
|
||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
YogaNode root = new YogaNode(config);
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MinHeight = 60;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(60f, root_child1.LayoutY);
|
||||
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(40f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(60f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(60f, root_child1.LayoutY);
|
||||
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(40f, root_child1.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void Test_min_width()
|
||||
{
|
||||
YogaConfig config = new YogaConfig();
|
||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
YogaNode root = new YogaNode(config);
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MinWidth = 60;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.FlexGrow = 1;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(60f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(40f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(40f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(40f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_justify_content_min_max()
|
||||
{
|
||||
|
@@ -263,6 +263,64 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(75f, root_child1.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void Test_percentage_flex_basis_cross_min_height()
|
||||
{
|
||||
YogaConfig config = new YogaConfig();
|
||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
YogaNode root = new YogaNode(config);
|
||||
root.Width = 200;
|
||||
root.Height = 200;
|
||||
|
||||
YogaNode root_child0 = new YogaNode(config);
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MinHeight = 60.Percent();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode(config);
|
||||
root_child1.FlexGrow = 2;
|
||||
root_child1.MinHeight = 10.Percent();
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(120f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(120f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(80f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(200f, root.LayoutWidth);
|
||||
Assert.AreEqual(200f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(120f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(120f, root_child1.LayoutY);
|
||||
Assert.AreEqual(200f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(80f, root_child1.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_percentage_flex_basis_main_max_height()
|
||||
{
|
||||
|
@@ -111,7 +111,8 @@
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_baseline_multiline_column" style="width: 100px; height: 100px; flex-direction:column; align-items: baseline;flex-wrap:wrap;">
|
||||
<!-- TODO: Yoga's behavior is no longer in line with Chromium -->
|
||||
<div id="align_baseline_multiline_column" data-disabled="true" style="width: 100px; height: 100px; flex-direction:column; align-items: baseline;flex-wrap:wrap;">
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
<div style="width: 30px; height: 50px;">
|
||||
<div style="width: 20px; height: 20px;"></div>
|
||||
@@ -122,7 +123,8 @@
|
||||
<div style="width: 50px; height: 20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_baseline_multiline_column2" style="width: 100px; height: 100px; flex-direction:column; align-items: baseline;flex-wrap:wrap;">
|
||||
<!-- TODO: Yoga's behavior is no longer in line with Chromium -->
|
||||
<div id="align_baseline_multiline_column2" data-disabled="true" style="width: 100px; height: 100px; flex-direction:column; align-items: baseline;flex-wrap:wrap;">
|
||||
<div style="width: 50px; height: 50px;flex-direction:column;"></div>
|
||||
<div style="width: 30px; height: 50px;flex-direction:column;">
|
||||
<div style="width: 20px; height: 20px;flex-direction:column;"></div>
|
||||
|
@@ -6,21 +6,17 @@
|
||||
<div style="width: 10px; max-height: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<!-- Chrome and Yoga disagree on the correct output -->
|
||||
<!--
|
||||
<div id="min_height" style="width: 100px; height: 100px;">
|
||||
<!-- TODO: Yoga's behavior is no longer in line with Chromium -->
|
||||
<div id="min_height" data-disabled="true" style="width: 100px; height: 100px;">
|
||||
<div style="flex-grow: 1; min-height: 60px;"></div>
|
||||
<div style="flex-grow: 1;"></div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<!-- Chrome and Yoga disagree on the correct output -->
|
||||
<!--
|
||||
<div id="min_width" style="width: 100px; height: 100px; flex-direction: row">
|
||||
<!-- TODO: Yoga's behavior is no longer in line with Chromium -->
|
||||
<div id="min_width" data-disabled="true" style="width: 100px; height: 100px; flex-direction: row">
|
||||
<div style="flex-grow: 1; min-width: 60px;"></div>
|
||||
<div style="flex-grow: 1;"></div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div id="justify_content_min_max" style="max-height: 200px; min-height: 100px; width: 100px; justify-content: center;">
|
||||
<div style="width: 60px; height: 60px;"></div>
|
||||
|
@@ -21,13 +21,11 @@
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Chrome and Yoga disagree on the correct output -->
|
||||
<!--
|
||||
<div id="percentage_flex_basis_cross_min_height" style="width: 200px; height: 200px; flex-direction: column;">
|
||||
<!-- TODO: Yoga's behavior is no longer in line with Chromium -->
|
||||
<div id="percentage_flex_basis_cross_min_height" data-disabled="true" style="width: 200px; height: 200px; flex-direction: column;">
|
||||
<div style="flex-grow: 1; min-height: 60%;"></div>
|
||||
<div style="flex-grow: 2; min-height: 10%;"></div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div id="percentage_flex_basis_main_max_height" style="width: 200px; height: 200px; flex-direction: row;">
|
||||
<div style="flex-grow: 1; flex-basis: 10%; max-height: 60%;"></div>
|
||||
|
@@ -34,10 +34,15 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
]);
|
||||
}},
|
||||
|
||||
emitTestPrologue:{value:function(name, experiments) {
|
||||
emitTestPrologue:{value:function(name, experiments, disabled) {
|
||||
this.push('TEST(YogaTest, ' + name + ') {');
|
||||
this.pushIndent();
|
||||
|
||||
if (disabled) {
|
||||
this.push('GTEST_SKIP();');
|
||||
this.push('');
|
||||
}
|
||||
|
||||
this.push('const YGConfigRef config = YGConfigNew();')
|
||||
for (var i in experiments) {
|
||||
this.push('YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' + experiments[i] +', true);');
|
||||
|
@@ -45,8 +45,11 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.pushIndent();
|
||||
}},
|
||||
|
||||
emitTestPrologue:{value:function(name, experiments) {
|
||||
emitTestPrologue:{value:function(name, experiments, disabled) {
|
||||
this.push('[Test]');
|
||||
if (disabled) {
|
||||
this.push('[Ignore]');
|
||||
}
|
||||
this.push('public void Test_' + name + '()');
|
||||
this.push('{');
|
||||
this.pushIndent();
|
||||
|
@@ -44,6 +44,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
'',
|
||||
'import static org.junit.Assert.assertEquals;',
|
||||
'',
|
||||
'import org.junit.Ignore;',
|
||||
'import org.junit.Test;',
|
||||
'import org.junit.runner.RunWith;',
|
||||
'import org.junit.runners.Parameterized;',
|
||||
@@ -67,8 +68,11 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
]);
|
||||
}},
|
||||
|
||||
emitTestPrologue:{value:function(name, experiments) {
|
||||
emitTestPrologue:{value:function(name, experiments, disabled) {
|
||||
this.push('@Test');
|
||||
if (disabled) {
|
||||
this.push('@Ignore');
|
||||
}
|
||||
this.push('public void test_' + name + '() {');
|
||||
this.pushIndent();
|
||||
|
||||
|
@@ -16,25 +16,35 @@ function toValueJavascript(value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
function toJavascriptUpper(symbol) {
|
||||
let out = '';
|
||||
for (let i = 0; i < symbol.length; i++) {
|
||||
const c = symbol.charAt(i);
|
||||
if (c == c.toUpperCase() && i != 0 && symbol[i - 1] != symbol[i - 1].toUpperCase()) {
|
||||
out += '_';
|
||||
}
|
||||
out += c.toUpperCase();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
constructor:{value:JavascriptEmitter},
|
||||
|
||||
emitPrologue:{value:function() {}},
|
||||
emitPrologue:{value:function() {
|
||||
this.push('import {Yoga} from "../tools/globals";')
|
||||
this.push('import {')
|
||||
this.pushIndent();
|
||||
this.push('Align,');
|
||||
this.push('Direction,');
|
||||
this.push('Display,');
|
||||
this.push('Edge,');
|
||||
this.push('Errata,');
|
||||
this.push('ExperimentalFeature,');
|
||||
this.push('FlexDirection,');
|
||||
this.push('Gutter,');
|
||||
this.push('Justify,');
|
||||
this.push('MeasureMode,');
|
||||
this.push('Overflow,');
|
||||
this.push('PositionType,');
|
||||
this.push('Unit,');
|
||||
this.push('Wrap,');
|
||||
this.popIndent();
|
||||
this.push('} from \'yoga-layout\';');
|
||||
this.push('');
|
||||
}},
|
||||
|
||||
emitTestPrologue:{value:function(name, experiments) {
|
||||
this.push('test(' + JSON.stringify(name) + ', () => {');
|
||||
emitTestPrologue:{value:function(name, experiments, ignore) {
|
||||
const testFn = ignore ? `test.skip` : 'test';
|
||||
this.push(`${testFn}('${name}', () => {`);
|
||||
this.pushIndent();
|
||||
this.push('const config = Yoga.Config.create();');
|
||||
this.push('let root;');
|
||||
@@ -42,7 +52,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
if (experiments.length > 0) {
|
||||
for (const experiment of experiments) {
|
||||
this.push('config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_' + toJavascriptUpper(experiment) + ', true);');
|
||||
this.push(`config.setExperimentalFeatureEnabled(ExperimentalFeature.${experiment}, true);`);
|
||||
}
|
||||
this.push('');
|
||||
}
|
||||
@@ -64,7 +74,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push('} finally {');
|
||||
this.pushIndent();
|
||||
|
||||
this.push('if (typeof root !== "undefined") {');
|
||||
this.push('if (typeof root !== \'undefined\') {');
|
||||
this.pushIndent();
|
||||
this.push('root.freeRecursive();');
|
||||
this.popIndent();
|
||||
@@ -87,61 +97,60 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push(`expect(${v1}).toBe(${v0});`);
|
||||
}},
|
||||
|
||||
YGAlignAuto:{value:'Yoga.ALIGN_AUTO'},
|
||||
YGAlignCenter:{value:'Yoga.ALIGN_CENTER'},
|
||||
YGAlignFlexEnd:{value:'Yoga.ALIGN_FLEX_END'},
|
||||
YGAlignFlexStart:{value:'Yoga.ALIGN_FLEX_START'},
|
||||
YGAlignStretch:{value:'Yoga.ALIGN_STRETCH'},
|
||||
YGAlignSpaceBetween:{value:'Yoga.ALIGN_SPACE_BETWEEN'},
|
||||
YGAlignSpaceAround:{value:'Yoga.ALIGN_SPACE_AROUND'},
|
||||
YGAlignBaseline:{value:'Yoga.ALIGN_BASELINE'},
|
||||
YGAlignAuto:{value: 'Align.Auto'},
|
||||
YGAlignCenter:{value: 'Align.Center'},
|
||||
YGAlignFlexEnd:{value: 'Align.FlexEnd'},
|
||||
YGAlignFlexStart:{value: 'Align.FlexStart'},
|
||||
YGAlignStretch:{value: 'Align.Stretch'},
|
||||
YGAlignSpaceBetween:{value: 'Align.SpaceBetween'},
|
||||
YGAlignSpaceAround:{value: 'Align.SpaceAround'},
|
||||
YGAlignBaseline:{value: 'Align.Baseline'},
|
||||
|
||||
YGDirectionInherit:{value:'Yoga.DIRECTION_INHERIT'},
|
||||
YGDirectionLTR:{value:'Yoga.DIRECTION_LTR'},
|
||||
YGDirectionRTL:{value:'Yoga.DIRECTION_RTL'},
|
||||
YGDirectionInherit:{value: 'Direction.Inherit'},
|
||||
YGDirectionLTR:{value: 'Direction.LTR'},
|
||||
YGDirectionRTL:{value: 'Direction.RTL'},
|
||||
|
||||
YGEdgeBottom:{value:'Yoga.EDGE_BOTTOM'},
|
||||
YGEdgeEnd:{value:'Yoga.EDGE_END'},
|
||||
YGEdgeLeft:{value:'Yoga.EDGE_LEFT'},
|
||||
YGEdgeRight:{value:'Yoga.EDGE_RIGHT'},
|
||||
YGEdgeStart:{value:'Yoga.EDGE_START'},
|
||||
YGEdgeTop:{value:'Yoga.EDGE_TOP'},
|
||||
YGEdgeBottom:{value: 'Edge.Bottom'},
|
||||
YGEdgeEnd:{value: 'Edge.End'},
|
||||
YGEdgeLeft:{value: 'Edge.Left'},
|
||||
YGEdgeRight:{value: 'Edge.Right'},
|
||||
YGEdgeStart:{value: 'Edge.Start'},
|
||||
YGEdgeTop:{value: 'Edge.Top'},
|
||||
|
||||
YGGutterAll:{value:'Yoga.GUTTER_ALL'},
|
||||
YGGutterColumn:{value:'Yoga.GUTTER_COLUMN'},
|
||||
YGGutterRow:{value:'Yoga.GUTTER_ROW'},
|
||||
YGGutterAll:{value: 'Gutter.All'},
|
||||
YGGutterColumn:{value: 'Gutter.Column'},
|
||||
YGGutterRow:{value: 'Gutter.Row'},
|
||||
|
||||
YGFlexDirectionColumn:{value:'Yoga.FLEX_DIRECTION_COLUMN'},
|
||||
YGFlexDirectionColumnReverse:{value:'Yoga.FLEX_DIRECTION_COLUMN_REVERSE'},
|
||||
YGFlexDirectionRow:{value:'Yoga.FLEX_DIRECTION_ROW'},
|
||||
YGFlexDirectionRowReverse:{value:'Yoga.FLEX_DIRECTION_ROW_REVERSE'},
|
||||
YGFlexDirectionColumn:{value: 'FlexDirection.Column'},
|
||||
YGFlexDirectionColumnReverse:{value: 'FlexDirection.ColumnReverse'},
|
||||
YGFlexDirectionRow:{value: 'FlexDirection.Row'},
|
||||
YGFlexDirectionRowReverse:{value: 'FlexDirection.RowReverse'},
|
||||
|
||||
YGJustifyCenter:{value:'Yoga.JUSTIFY_CENTER'},
|
||||
YGJustifyFlexEnd:{value:'Yoga.JUSTIFY_FLEX_END'},
|
||||
YGJustifyFlexStart:{value:'Yoga.JUSTIFY_FLEX_START'},
|
||||
YGJustifySpaceAround:{value:'Yoga.JUSTIFY_SPACE_AROUND'},
|
||||
YGJustifySpaceBetween:{value:'Yoga.JUSTIFY_SPACE_BETWEEN'},
|
||||
YGJustifySpaceEvenly:{value:'Yoga.JUSTIFY_SPACE_EVENLY'},
|
||||
YGJustifyCenter:{value: 'Justify.Center'},
|
||||
YGJustifyFlexEnd:{value: 'Justify.FlexEnd'},
|
||||
YGJustifyFlexStart:{value: 'Justify.FlexStart'},
|
||||
YGJustifySpaceAround:{value: 'Justify.SpaceAround'},
|
||||
YGJustifySpaceBetween:{value: 'Justify.SpaceBetween'},
|
||||
YGJustifySpaceEvenly:{value: 'Justify.SpaceEvenly'},
|
||||
|
||||
YGOverflowHidden:{value:'Yoga.OVERFLOW_HIDDEN'},
|
||||
YGOverflowVisible:{value:'Yoga.OVERFLOW_VISIBLE'},
|
||||
YGOverflowHidden:{value: 'Overflow.Hidden'},
|
||||
YGOverflowVisible:{value: 'Overflow.Visible'},
|
||||
|
||||
YGPositionTypeAbsolute:{value:'Yoga.POSITION_TYPE_ABSOLUTE'},
|
||||
YGPositionTypeRelative:{value:'Yoga.POSITION_TYPE_RELATIVE'},
|
||||
YGPositionTypeAbsolute:{value: 'PositionType.Absolute'},
|
||||
YGPositionTypeRelative:{value: 'PositionType.Relative'},
|
||||
|
||||
YGAuto:{value:'Yoga.AUTO'},
|
||||
YGAuto:{value:'\'auto\''},
|
||||
YGUndefined:{value:'undefined'},
|
||||
|
||||
YGWrapNoWrap:{value:'Yoga.WRAP_NO_WRAP'},
|
||||
YGWrapWrap:{value:'Yoga.WRAP_WRAP'},
|
||||
YGWrapWrapReverse:{value: 'Yoga.WRAP_WRAP_REVERSE'},
|
||||
YGWrapNoWrap:{value: 'Wrap.NoWrap'},
|
||||
YGWrapWrap:{value: 'Wrap.Wrap'},
|
||||
YGWrapWrapReverse:{value: 'Wrap.WrapReverse'},
|
||||
|
||||
YGUndefined:{value:'Yoga.UNDEFINED'},
|
||||
|
||||
YGDisplayFlex:{value:'Yoga.DISPLAY_FLEX'},
|
||||
YGDisplayNone:{value:'Yoga.DISPLAY_NONE'},
|
||||
YGDisplayFlex:{value: 'Display.Flex'},
|
||||
YGDisplayNone:{value: 'Display.None'},
|
||||
|
||||
YGNodeCalculateLayout:{value:function(node, dir, experiments) {
|
||||
this.push(node + '.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, ' + dir + ');');
|
||||
this.push(node + '.calculateLayout(undefined, undefined, ' + dir + ');');
|
||||
}},
|
||||
|
||||
YGNodeInsertChild:{value:function(parentName, nodeName, index) {
|
||||
|
@@ -68,7 +68,11 @@ function printTest(e, ext, LTRContainer, RTLContainer, genericContainer) {
|
||||
|
||||
|
||||
for (var i = 0; i < genericLayoutTree.length; i++) {
|
||||
e.emitTestPrologue(genericLayoutTree[i].name, genericLayoutTree[i].experiments);
|
||||
e.emitTestPrologue(
|
||||
genericLayoutTree[i].name,
|
||||
genericLayoutTree[i].experiments,
|
||||
genericLayoutTree[i].disabled
|
||||
);
|
||||
|
||||
if (genericLayoutTree[i].name == 'wrap_column') {
|
||||
// Modify width and left values due to both safari and chrome not abiding by the
|
||||
@@ -475,9 +479,10 @@ function calculateTree(root, roundToPixelGrid) {
|
||||
style: getYogaStyle(child),
|
||||
declaredStyle: child.style,
|
||||
rawStyle: child.getAttribute('style'),
|
||||
experiments: child.getAttribute('experiments')
|
||||
? child.getAttribute('experiments').split(' ')
|
||||
experiments: child.dataset.experiments
|
||||
? child.dataset.experiments.split(' ')
|
||||
: DEFAULT_EXPERIMENTS,
|
||||
disabled: child.dataset.disabled === 'true',
|
||||
};
|
||||
|
||||
var size = getRoundedSize(child);
|
||||
|
@@ -56,7 +56,7 @@ Dir['fixtures/*.html'].each do |file|
|
||||
|
||||
print logs[4]
|
||||
|
||||
f = File.open("../javascript/tests/generated/#{name}.test.js", 'w')
|
||||
f = File.open("../javascript/tests/generated/#{name}.test.ts", 'w')
|
||||
f.write eval(logs[3].message.sub(/^[^"]*/, '')).sub('YogaTest', name)
|
||||
f.close
|
||||
end
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
@@ -1259,6 +1260,7 @@ public class YGAlignItemsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_align_baseline_multiline_column() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
@@ -1350,7 +1352,7 @@ public class YGAlignItemsTest {
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
@@ -1360,7 +1362,7 @@ public class YGAlignItemsTest {
|
||||
assertEquals(20f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(70f, root_child2.getLayoutHeight(), 0.0f);
|
||||
@@ -1377,6 +1379,7 @@ public class YGAlignItemsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_align_baseline_multiline_column2() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
@@ -1468,7 +1471,7 @@ public class YGAlignItemsTest {
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
@@ -1478,7 +1481,7 @@ public class YGAlignItemsTest {
|
||||
assertEquals(20f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(70f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
@@ -107,6 +108,119 @@ public class YGMinMaxDimensionTest {
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_min_height() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root_child0.setMinHeight(60f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_min_width() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root_child0.setMinWidth(60f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_min_max() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
@@ -267,6 +268,63 @@ public class YGPercentageTest {
|
||||
assertEquals(75f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_percentage_flex_basis_cross_min_height() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setWidth(200f);
|
||||
root.setHeight(200f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root_child0.setMinHeightPercent(60f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(2f);
|
||||
root_child1.setMinHeightPercent(10f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(120f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(80f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(120f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(80f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_percentage_flex_basis_main_max_height() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -11,6 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
@@ -12,6 +12,16 @@ import type {Config} from 'jest';
|
||||
const config: Config = {
|
||||
setupFiles: ['./jest.setup.ts'],
|
||||
testRegex: '/tests/.*\\.test\\.[jt]s$',
|
||||
moduleNameMapper: {
|
||||
'yoga-layout':
|
||||
process.env['SYNC'] === '1' && process.env['WASM'] === '1'
|
||||
? 'yoga-layout/wasm-sync'
|
||||
: process.env['SYNC'] === '1'
|
||||
? 'yoga-layout/asmjs-sync'
|
||||
: process.env['WASM'] === '1'
|
||||
? 'yoga-layout/wasm-async'
|
||||
: 'yoga-layout/asmjs-async',
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
@@ -8,15 +8,8 @@
|
||||
*/
|
||||
|
||||
module.exports = async () => {
|
||||
if (process.env['SYNC'] === '1' && process.env['WASM'] === '1') {
|
||||
globalThis.Yoga = require('yoga-layout/wasm-sync').default;
|
||||
} else if (process.env['SYNC'] === '1') {
|
||||
globalThis.Yoga = require('yoga-layout/asmjs-sync').default;
|
||||
} else if (process.env['WASM'] === '1') {
|
||||
globalThis.Yoga = await require('yoga-layout/wasm-async').loadYoga();
|
||||
} else {
|
||||
globalThis.Yoga = await require('yoga-layout/asmjs-async').loadYoga();
|
||||
}
|
||||
const {loadYoga, default: Yoga} = require('yoga-layout');
|
||||
globalThis.Yoga = Yoga ?? (await loadYoga());
|
||||
};
|
||||
|
||||
Object.defineProperty(globalThis, 'YGBENCHMARK', {
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,17 +7,35 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
test("align_content_flex_start", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('align_content_flex_start', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(130);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -45,7 +63,7 @@ test("align_content_flex_start", () => {
|
||||
root_child4.setWidth(50);
|
||||
root_child4.setHeight(10);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -77,7 +95,7 @@ test("align_content_flex_start", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -109,23 +127,23 @@ test("align_content_flex_start", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_flex_start_without_height_on_children", () => {
|
||||
test('align_content_flex_start_without_height_on_children', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -150,7 +168,7 @@ test("align_content_flex_start_without_height_on_children", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -182,7 +200,7 @@ test("align_content_flex_start_without_height_on_children", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -214,23 +232,23 @@ test("align_content_flex_start_without_height_on_children", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_flex_start_with_flex", () => {
|
||||
test('align_content_flex_start_with_flex', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(120);
|
||||
|
||||
@@ -261,7 +279,7 @@ test("align_content_flex_start_with_flex", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -293,7 +311,7 @@ test("align_content_flex_start_with_flex", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -325,24 +343,24 @@ test("align_content_flex_start_with_flex", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_flex_end", () => {
|
||||
test('align_content_flex_end', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignContent(Yoga.ALIGN_FLEX_END);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setAlignContent(Align.FlexEnd);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -370,7 +388,7 @@ test("align_content_flex_end", () => {
|
||||
root_child4.setWidth(50);
|
||||
root_child4.setHeight(10);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -402,7 +420,7 @@ test("align_content_flex_end", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -434,24 +452,24 @@ test("align_content_flex_end", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch", () => {
|
||||
test('align_content_stretch', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -474,7 +492,7 @@ test("align_content_stretch", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -506,7 +524,7 @@ test("align_content_stretch", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -538,25 +556,25 @@ test("align_content_stretch", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_spacebetween", () => {
|
||||
test('align_content_spacebetween', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_SPACE_BETWEEN);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.SpaceBetween);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(130);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -584,7 +602,7 @@ test("align_content_spacebetween", () => {
|
||||
root_child4.setWidth(50);
|
||||
root_child4.setHeight(10);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -616,7 +634,7 @@ test("align_content_spacebetween", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -648,25 +666,25 @@ test("align_content_spacebetween", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_spacearound", () => {
|
||||
test('align_content_spacearound', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_SPACE_AROUND);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.SpaceAround);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(140);
|
||||
root.setHeight(120);
|
||||
|
||||
@@ -694,7 +712,7 @@ test("align_content_spacearound", () => {
|
||||
root_child4.setWidth(50);
|
||||
root_child4.setHeight(10);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -726,7 +744,7 @@ test("align_content_spacearound", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -758,25 +776,25 @@ test("align_content_spacearound", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row", () => {
|
||||
test('align_content_stretch_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -799,7 +817,7 @@ test("align_content_stretch_row", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -831,7 +849,7 @@ test("align_content_stretch_row", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -863,25 +881,25 @@ test("align_content_stretch_row", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_children", () => {
|
||||
test('align_content_stretch_row_with_children', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -910,7 +928,7 @@ test("align_content_stretch_row_with_children", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -947,7 +965,7 @@ test("align_content_stretch_row_with_children", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -984,25 +1002,25 @@ test("align_content_stretch_row_with_children", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_flex", () => {
|
||||
test('align_content_stretch_row_with_flex', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1031,7 +1049,7 @@ test("align_content_stretch_row_with_flex", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1063,7 +1081,7 @@ test("align_content_stretch_row_with_flex", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1095,25 +1113,25 @@ test("align_content_stretch_row_with_flex", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_flex_no_shrink", () => {
|
||||
test('align_content_stretch_row_with_flex_no_shrink', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1141,7 +1159,7 @@ test("align_content_stretch_row_with_flex_no_shrink", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1173,7 +1191,7 @@ test("align_content_stretch_row_with_flex_no_shrink", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1205,25 +1223,25 @@ test("align_content_stretch_row_with_flex_no_shrink", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_margin", () => {
|
||||
test('align_content_stretch_row_with_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1232,10 +1250,10 @@ test("align_content_stretch_row_with_margin", () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setMargin(Yoga.EDGE_LEFT, 10);
|
||||
root_child1.setMargin(Yoga.EDGE_TOP, 10);
|
||||
root_child1.setMargin(Yoga.EDGE_RIGHT, 10);
|
||||
root_child1.setMargin(Yoga.EDGE_BOTTOM, 10);
|
||||
root_child1.setMargin(Edge.Left, 10);
|
||||
root_child1.setMargin(Edge.Top, 10);
|
||||
root_child1.setMargin(Edge.Right, 10);
|
||||
root_child1.setMargin(Edge.Bottom, 10);
|
||||
root_child1.setWidth(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
@@ -1244,17 +1262,17 @@ test("align_content_stretch_row_with_margin", () => {
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setMargin(Yoga.EDGE_LEFT, 10);
|
||||
root_child3.setMargin(Yoga.EDGE_TOP, 10);
|
||||
root_child3.setMargin(Yoga.EDGE_RIGHT, 10);
|
||||
root_child3.setMargin(Yoga.EDGE_BOTTOM, 10);
|
||||
root_child3.setMargin(Edge.Left, 10);
|
||||
root_child3.setMargin(Edge.Top, 10);
|
||||
root_child3.setMargin(Edge.Right, 10);
|
||||
root_child3.setMargin(Edge.Bottom, 10);
|
||||
root_child3.setWidth(50);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1286,7 +1304,7 @@ test("align_content_stretch_row_with_margin", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1318,25 +1336,25 @@ test("align_content_stretch_row_with_margin", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_padding", () => {
|
||||
test('align_content_stretch_row_with_padding', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1345,10 +1363,10 @@ test("align_content_stretch_row_with_padding", () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPadding(Yoga.EDGE_LEFT, 10);
|
||||
root_child1.setPadding(Yoga.EDGE_TOP, 10);
|
||||
root_child1.setPadding(Yoga.EDGE_RIGHT, 10);
|
||||
root_child1.setPadding(Yoga.EDGE_BOTTOM, 10);
|
||||
root_child1.setPadding(Edge.Left, 10);
|
||||
root_child1.setPadding(Edge.Top, 10);
|
||||
root_child1.setPadding(Edge.Right, 10);
|
||||
root_child1.setPadding(Edge.Bottom, 10);
|
||||
root_child1.setWidth(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
@@ -1357,17 +1375,17 @@ test("align_content_stretch_row_with_padding", () => {
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPadding(Yoga.EDGE_LEFT, 10);
|
||||
root_child3.setPadding(Yoga.EDGE_TOP, 10);
|
||||
root_child3.setPadding(Yoga.EDGE_RIGHT, 10);
|
||||
root_child3.setPadding(Yoga.EDGE_BOTTOM, 10);
|
||||
root_child3.setPadding(Edge.Left, 10);
|
||||
root_child3.setPadding(Edge.Top, 10);
|
||||
root_child3.setPadding(Edge.Right, 10);
|
||||
root_child3.setPadding(Edge.Bottom, 10);
|
||||
root_child3.setWidth(50);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1399,7 +1417,7 @@ test("align_content_stretch_row_with_padding", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1431,25 +1449,25 @@ test("align_content_stretch_row_with_padding", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_single_row", () => {
|
||||
test('align_content_stretch_row_with_single_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1460,7 +1478,7 @@ test("align_content_stretch_row_with_single_row", () => {
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1477,7 +1495,7 @@ test("align_content_stretch_row_with_single_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1494,25 +1512,25 @@ test("align_content_stretch_row_with_single_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_fixed_height", () => {
|
||||
test('align_content_stretch_row_with_fixed_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1536,7 +1554,7 @@ test("align_content_stretch_row_with_fixed_height", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1568,7 +1586,7 @@ test("align_content_stretch_row_with_fixed_height", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1600,25 +1618,25 @@ test("align_content_stretch_row_with_fixed_height", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_max_height", () => {
|
||||
test('align_content_stretch_row_with_max_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1642,7 +1660,7 @@ test("align_content_stretch_row_with_max_height", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1674,7 +1692,7 @@ test("align_content_stretch_row_with_max_height", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1706,25 +1724,25 @@ test("align_content_stretch_row_with_max_height", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_row_with_min_height", () => {
|
||||
test('align_content_stretch_row_with_min_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(150);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1748,7 +1766,7 @@ test("align_content_stretch_row_with_min_height", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setWidth(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1780,7 +1798,7 @@ test("align_content_stretch_row_with_min_height", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1812,24 +1830,24 @@ test("align_content_stretch_row_with_min_height", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_column", () => {
|
||||
test('align_content_stretch_column', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setFlexWrap(Yoga.WRAP_WRAP);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(150);
|
||||
|
||||
@@ -1861,7 +1879,7 @@ test("align_content_stretch_column", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setHeight(50);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1898,7 +1916,7 @@ test("align_content_stretch_column", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1935,38 +1953,38 @@ test("align_content_stretch_column", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(50);
|
||||
expect(root_child4.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_content_stretch_is_not_overriding_align_items", () => {
|
||||
test('align_content_stretch_is_not_overriding_align_items', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0.setAlignContent(Align.Stretch);
|
||||
root_child0.setAlignItems(Align.Center);
|
||||
root_child0.setWidth(100);
|
||||
root_child0.setHeight(100);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0.setWidth(10);
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1983,7 +2001,7 @@ test("align_content_stretch_is_not_overriding_align_items", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -2000,7 +2018,7 @@ test("align_content_stretch_is_not_overriding_align_items", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,12 +7,30 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||
|
||||
test("align_self_center", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('align_self_center', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -20,11 +38,11 @@ test("align_self_center", () => {
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Yoga.ALIGN_CENTER);
|
||||
root_child0.setAlignSelf(Align.Center);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -36,7 +54,7 @@ test("align_self_center", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -48,19 +66,19 @@ test("align_self_center", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_self_flex_end", () => {
|
||||
test('align_self_flex_end', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -68,11 +86,11 @@ test("align_self_flex_end", () => {
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END);
|
||||
root_child0.setAlignSelf(Align.FlexEnd);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -84,7 +102,7 @@ test("align_self_flex_end", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -96,19 +114,19 @@ test("align_self_flex_end", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_self_flex_start", () => {
|
||||
test('align_self_flex_start', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -116,11 +134,11 @@ test("align_self_flex_start", () => {
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Yoga.ALIGN_FLEX_START);
|
||||
root_child0.setAlignSelf(Align.FlexStart);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -132,7 +150,7 @@ test("align_self_flex_start", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -144,32 +162,32 @@ test("align_self_flex_start", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_self_flex_end_override_flex_start", () => {
|
||||
test('align_self_flex_end_override_flex_start', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Yoga.ALIGN_FLEX_START);
|
||||
root.setAlignItems(Align.FlexStart);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END);
|
||||
root_child0.setAlignSelf(Align.FlexEnd);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -181,7 +199,7 @@ test("align_self_flex_end_override_flex_start", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -193,34 +211,34 @@ test("align_self_flex_end_override_flex_start", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("align_self_baseline", () => {
|
||||
test('align_self_baseline', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Yoga.ALIGN_BASELINE);
|
||||
root_child0.setAlignSelf(Align.Baseline);
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setAlignSelf(Yoga.ALIGN_BASELINE);
|
||||
root_child1.setAlignSelf(Align.Baseline);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -229,7 +247,7 @@ test("align_self_baseline", () => {
|
||||
root_child1_child0.setWidth(50);
|
||||
root_child1_child0.setHeight(10);
|
||||
root_child1.insertChild(root_child1_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -251,7 +269,7 @@ test("align_self_baseline", () => {
|
||||
expect(root_child1_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child1_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -273,7 +291,7 @@ test("align_self_baseline", () => {
|
||||
expect(root_child1_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child1_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,113 +7,131 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
|
||||
test("android_news_feed", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('android_news_feed', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setWidth(1080);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0_child0.setAlignItems(Yoga.ALIGN_FLEX_START);
|
||||
root_child0_child0_child0_child0.setMargin(Yoga.EDGE_START, 36);
|
||||
root_child0_child0_child0_child0.setMargin(Yoga.EDGE_TOP, 24);
|
||||
root_child0_child0_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0_child0.setAlignItems(Align.FlexStart);
|
||||
root_child0_child0_child0_child0.setMargin(Edge.Start, 36);
|
||||
root_child0_child0_child0_child0.setMargin(Edge.Top, 24);
|
||||
root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child0_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0_child0_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0_child0_child0_child0.setWidth(120);
|
||||
root_child0_child0_child0_child0_child0_child0.setHeight(120);
|
||||
root_child0_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0_child0_child1.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0_child0_child1.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0_child0_child1.setFlexShrink(1);
|
||||
root_child0_child0_child0_child0_child1.setMargin(Yoga.EDGE_RIGHT, 36);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Yoga.EDGE_LEFT, 36);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Yoga.EDGE_TOP, 21);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Yoga.EDGE_RIGHT, 36);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Yoga.EDGE_BOTTOM, 18);
|
||||
root_child0_child0_child0_child0_child1.setMargin(Edge.Right, 36);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Edge.Left, 36);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Edge.Top, 21);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Edge.Right, 36);
|
||||
root_child0_child0_child0_child0_child1.setPadding(Edge.Bottom, 18);
|
||||
root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child1, 1);
|
||||
|
||||
const root_child0_child0_child0_child0_child1_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0_child0_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child0_child0_child1_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0_child0_child1_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child0_child0_child1_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0_child0_child1_child0.setFlexShrink(1);
|
||||
root_child0_child0_child0_child0_child1.insertChild(root_child0_child0_child0_child0_child1_child0, 0);
|
||||
|
||||
const root_child0_child0_child0_child0_child1_child1 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0_child0_child1_child1.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0_child0_child1_child1.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0_child0_child1_child1.setFlexShrink(1);
|
||||
root_child0_child0_child0_child0_child1.insertChild(root_child0_child0_child0_child0_child1_child1, 1);
|
||||
|
||||
const root_child0_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child1.setAlignContent(Align.Stretch);
|
||||
root_child0_child0.insertChild(root_child0_child0_child1, 1);
|
||||
|
||||
const root_child0_child0_child1_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child1_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child1_child0.setAlignItems(Yoga.ALIGN_FLEX_START);
|
||||
root_child0_child0_child1_child0.setMargin(Yoga.EDGE_START, 174);
|
||||
root_child0_child0_child1_child0.setMargin(Yoga.EDGE_TOP, 24);
|
||||
root_child0_child0_child1_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child1_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child1_child0.setAlignItems(Align.FlexStart);
|
||||
root_child0_child0_child1_child0.setMargin(Edge.Start, 174);
|
||||
root_child0_child0_child1_child0.setMargin(Edge.Top, 24);
|
||||
root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0);
|
||||
|
||||
const root_child0_child0_child1_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child1_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child1_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child1_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child1_child0.insertChild(root_child0_child0_child1_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child1_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child1_child0_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child1_child0_child0_child0.setWidth(72);
|
||||
root_child0_child0_child1_child0_child0_child0.setHeight(72);
|
||||
root_child0_child0_child1_child0_child0.insertChild(root_child0_child0_child1_child0_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child1_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1_child0_child1.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child1_child0_child1.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child1_child0_child1.setFlexShrink(1);
|
||||
root_child0_child0_child1_child0_child1.setMargin(Yoga.EDGE_RIGHT, 36);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Yoga.EDGE_LEFT, 36);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Yoga.EDGE_TOP, 21);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Yoga.EDGE_RIGHT, 36);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Yoga.EDGE_BOTTOM, 18);
|
||||
root_child0_child0_child1_child0_child1.setMargin(Edge.Right, 36);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Edge.Left, 36);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Edge.Top, 21);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Edge.Right, 36);
|
||||
root_child0_child0_child1_child0_child1.setPadding(Edge.Bottom, 18);
|
||||
root_child0_child0_child1_child0.insertChild(root_child0_child0_child1_child0_child1, 1);
|
||||
|
||||
const root_child0_child0_child1_child0_child1_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1_child0_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child1_child0_child1_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child1_child0_child1_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child1_child0_child1_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child1_child0_child1_child0.setFlexShrink(1);
|
||||
root_child0_child0_child1_child0_child1.insertChild(root_child0_child0_child1_child0_child1_child0, 0);
|
||||
|
||||
const root_child0_child0_child1_child0_child1_child1 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1_child0_child1_child1.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child1_child0_child1_child1.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child1_child0_child1_child1.setFlexShrink(1);
|
||||
root_child0_child0_child1_child0_child1.insertChild(root_child0_child0_child1_child0_child1_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -200,7 +218,7 @@ test("android_news_feed", () => {
|
||||
expect(root_child0_child0_child1_child0_child1_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child0_child0_child1_child0_child1_child1.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -287,7 +305,7 @@ test("android_news_feed", () => {
|
||||
expect(root_child0_child0_child1_child0_child1_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child0_child0_child1_child0_child1_child1.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,59 +7,77 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||
|
||||
test("border_no_size", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('border_no_size', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setBorder(Yoga.EDGE_LEFT, 10);
|
||||
root.setBorder(Yoga.EDGE_TOP, 10);
|
||||
root.setBorder(Yoga.EDGE_RIGHT, 10);
|
||||
root.setBorder(Yoga.EDGE_BOTTOM, 10);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.setBorder(Edge.Left, 10);
|
||||
root.setBorder(Edge.Top, 10);
|
||||
root.setBorder(Edge.Right, 10);
|
||||
root.setBorder(Edge.Bottom, 10);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(20);
|
||||
expect(root.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(20);
|
||||
expect(root.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("border_container_match_child", () => {
|
||||
test('border_container_match_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setBorder(Yoga.EDGE_LEFT, 10);
|
||||
root.setBorder(Yoga.EDGE_TOP, 10);
|
||||
root.setBorder(Yoga.EDGE_RIGHT, 10);
|
||||
root.setBorder(Yoga.EDGE_BOTTOM, 10);
|
||||
root.setBorder(Edge.Left, 10);
|
||||
root.setBorder(Edge.Top, 10);
|
||||
root.setBorder(Edge.Right, 10);
|
||||
root.setBorder(Edge.Bottom, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -71,7 +89,7 @@ test("border_container_match_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -83,26 +101,26 @@ test("border_container_match_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("border_flex_child", () => {
|
||||
test('border_flex_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setBorder(Yoga.EDGE_LEFT, 10);
|
||||
root.setBorder(Yoga.EDGE_TOP, 10);
|
||||
root.setBorder(Yoga.EDGE_RIGHT, 10);
|
||||
root.setBorder(Yoga.EDGE_BOTTOM, 10);
|
||||
root.setBorder(Edge.Left, 10);
|
||||
root.setBorder(Edge.Top, 10);
|
||||
root.setBorder(Edge.Right, 10);
|
||||
root.setBorder(Edge.Bottom, 10);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -110,7 +128,7 @@ test("border_flex_child", () => {
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setWidth(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -122,7 +140,7 @@ test("border_flex_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(80);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -134,33 +152,33 @@ test("border_flex_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(80);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("border_stretch_child", () => {
|
||||
test('border_stretch_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setBorder(Yoga.EDGE_LEFT, 10);
|
||||
root.setBorder(Yoga.EDGE_TOP, 10);
|
||||
root.setBorder(Yoga.EDGE_RIGHT, 10);
|
||||
root.setBorder(Yoga.EDGE_BOTTOM, 10);
|
||||
root.setBorder(Edge.Left, 10);
|
||||
root.setBorder(Edge.Top, 10);
|
||||
root.setBorder(Edge.Right, 10);
|
||||
root.setBorder(Edge.Bottom, 10);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -172,7 +190,7 @@ test("border_stretch_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(80);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -184,27 +202,27 @@ test("border_stretch_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(80);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("border_center_child", () => {
|
||||
test('border_center_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setBorder(Yoga.EDGE_START, 10);
|
||||
root.setBorder(Yoga.EDGE_END, 20);
|
||||
root.setBorder(Yoga.EDGE_BOTTOM, 20);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setBorder(Edge.Start, 10);
|
||||
root.setBorder(Edge.End, 20);
|
||||
root.setBorder(Edge.Bottom, 20);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -212,7 +230,7 @@ test("border_center_child", () => {
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -224,7 +242,7 @@ test("border_center_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -236,7 +254,7 @@ test("border_center_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,12 +7,30 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||
|
||||
test("wrap_child", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('wrap_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -21,7 +39,7 @@ test("wrap_child", () => {
|
||||
root_child0.setWidth(100);
|
||||
root_child0.setHeight(100);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -33,7 +51,7 @@ test("wrap_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -45,19 +63,19 @@ test("wrap_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("wrap_grandchild", () => {
|
||||
test('wrap_grandchild', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -69,7 +87,7 @@ test("wrap_grandchild", () => {
|
||||
root_child0_child0.setWidth(100);
|
||||
root_child0_child0.setHeight(100);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -86,7 +104,7 @@ test("wrap_grandchild", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -103,7 +121,7 @@ test("wrap_grandchild", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,16 +7,34 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
test("display_none", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('display_none', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -26,9 +44,9 @@ test("display_none", () => {
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setDisplay(Yoga.DISPLAY_NONE);
|
||||
root_child1.setDisplay(Display.None);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -45,7 +63,7 @@ test("display_none", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -62,23 +80,23 @@ test("display_none", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("display_none_fixed_size", () => {
|
||||
test('display_none_fixed_size', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -89,9 +107,9 @@ test("display_none_fixed_size", () => {
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root_child1.setDisplay(Yoga.DISPLAY_NONE);
|
||||
root_child1.setDisplay(Display.None);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -108,7 +126,7 @@ test("display_none_fixed_size", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -125,40 +143,40 @@ test("display_none_fixed_size", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("display_none_with_margin", () => {
|
||||
test('display_none_with_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setMargin(Yoga.EDGE_LEFT, 10);
|
||||
root_child0.setMargin(Yoga.EDGE_TOP, 10);
|
||||
root_child0.setMargin(Yoga.EDGE_RIGHT, 10);
|
||||
root_child0.setMargin(Yoga.EDGE_BOTTOM, 10);
|
||||
root_child0.setMargin(Edge.Left, 10);
|
||||
root_child0.setMargin(Edge.Top, 10);
|
||||
root_child0.setMargin(Edge.Right, 10);
|
||||
root_child0.setMargin(Edge.Bottom, 10);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root_child0.setDisplay(Yoga.DISPLAY_NONE);
|
||||
root_child0.setDisplay(Display.None);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexGrow(1);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -175,7 +193,7 @@ test("display_none_with_margin", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -192,23 +210,23 @@ test("display_none_with_margin", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("display_none_with_child", () => {
|
||||
test('display_none_with_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -222,7 +240,7 @@ test("display_none_with_child", () => {
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setFlexShrink(1);
|
||||
root_child1.setFlexBasis("0%");
|
||||
root_child1.setDisplay(Yoga.DISPLAY_NONE);
|
||||
root_child1.setDisplay(Display.None);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child1_child0 = Yoga.Node.create(config);
|
||||
@@ -237,7 +255,7 @@ test("display_none_with_child", () => {
|
||||
root_child2.setFlexShrink(1);
|
||||
root_child2.setFlexBasis("0%");
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -264,7 +282,7 @@ test("display_none_with_child", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -291,23 +309,23 @@ test("display_none_with_child", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("display_none_with_position", () => {
|
||||
test('display_none_with_position', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -317,10 +335,10 @@ test("display_none_with_position", () => {
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setPosition(Yoga.EDGE_TOP, 10);
|
||||
root_child1.setDisplay(Yoga.DISPLAY_NONE);
|
||||
root_child1.setPosition(Edge.Top, 10);
|
||||
root_child1.setDisplay(Display.None);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -337,7 +355,7 @@ test("display_none_with_position", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -354,19 +372,19 @@ test("display_none_with_position", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("display_none_with_position_absolute", () => {
|
||||
test('display_none_with_position_absolute', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -374,12 +392,12 @@ test("display_none_with_position_absolute", () => {
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPositionType(PositionType.Absolute);
|
||||
root_child0.setWidth(100);
|
||||
root_child0.setHeight(100);
|
||||
root_child0.setDisplay(Yoga.DISPLAY_NONE);
|
||||
root_child0.setDisplay(Display.None);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -391,7 +409,7 @@ test("display_none_with_position_absolute", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -403,7 +421,7 @@ test("display_none_with_position_absolute", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,12 +7,30 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
test("flex_direction_column_no_height", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('flex_direction_column_no_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -29,7 +47,7 @@ test("flex_direction_column_no_height", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -51,7 +69,7 @@ test("flex_direction_column_no_height", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -73,23 +91,23 @@ test("flex_direction_column_no_height", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_direction_row_no_width", () => {
|
||||
test('flex_direction_row_no_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
@@ -103,7 +121,7 @@ test("flex_direction_row_no_width", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -125,7 +143,7 @@ test("flex_direction_row_no_width", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -147,19 +165,19 @@ test("flex_direction_row_no_width", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_direction_column", () => {
|
||||
test('flex_direction_column', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -177,7 +195,7 @@ test("flex_direction_column", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -199,7 +217,7 @@ test("flex_direction_column", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -221,23 +239,23 @@ test("flex_direction_column", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_direction_row", () => {
|
||||
test('flex_direction_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -252,7 +270,7 @@ test("flex_direction_row", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -274,7 +292,7 @@ test("flex_direction_row", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -296,23 +314,23 @@ test("flex_direction_row", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_direction_column_reverse", () => {
|
||||
test('flex_direction_column_reverse', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN_REVERSE);
|
||||
root.setFlexDirection(FlexDirection.ColumnReverse);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -327,7 +345,7 @@ test("flex_direction_column_reverse", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -349,7 +367,7 @@ test("flex_direction_column_reverse", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -371,23 +389,23 @@ test("flex_direction_column_reverse", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_direction_row_reverse", () => {
|
||||
test('flex_direction_row_reverse', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW_REVERSE);
|
||||
root.setFlexDirection(FlexDirection.RowReverse);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -402,7 +420,7 @@ test("flex_direction_row_reverse", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -424,7 +442,7 @@ test("flex_direction_row_reverse", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -446,7 +464,7 @@ test("flex_direction_row_reverse", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,12 +7,30 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||
|
||||
test("flex_basis_flex_grow_column", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('flex_basis_flex_grow_column', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -27,7 +45,7 @@ test("flex_basis_flex_grow_column", () => {
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexGrow(1);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -44,7 +62,7 @@ test("flex_basis_flex_grow_column", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(25);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -61,23 +79,23 @@ test("flex_basis_flex_grow_column", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(25);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_shrink_flex_grow_row", () => {
|
||||
test('flex_shrink_flex_grow_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(500);
|
||||
root.setHeight(500);
|
||||
|
||||
@@ -92,7 +110,7 @@ test("flex_shrink_flex_grow_row", () => {
|
||||
root_child1.setWidth(500);
|
||||
root_child1.setHeight(100);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -109,7 +127,7 @@ test("flex_shrink_flex_grow_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(250);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -126,23 +144,23 @@ test("flex_shrink_flex_grow_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(250);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_shrink_flex_grow_child_flex_shrink_other_child", () => {
|
||||
test('flex_shrink_flex_grow_child_flex_shrink_other_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(500);
|
||||
root.setHeight(500);
|
||||
|
||||
@@ -158,7 +176,7 @@ test("flex_shrink_flex_grow_child_flex_shrink_other_child", () => {
|
||||
root_child1.setWidth(500);
|
||||
root_child1.setHeight(100);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -175,7 +193,7 @@ test("flex_shrink_flex_grow_child_flex_shrink_other_child", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(250);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -192,23 +210,23 @@ test("flex_shrink_flex_grow_child_flex_shrink_other_child", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(250);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_basis_flex_grow_row", () => {
|
||||
test('flex_basis_flex_grow_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -220,7 +238,7 @@ test("flex_basis_flex_grow_row", () => {
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexGrow(1);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -237,7 +255,7 @@ test("flex_basis_flex_grow_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(25);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -254,19 +272,19 @@ test("flex_basis_flex_grow_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(25);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_basis_flex_shrink_column", () => {
|
||||
test('flex_basis_flex_shrink_column', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -281,7 +299,7 @@ test("flex_basis_flex_shrink_column", () => {
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexBasis(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -298,7 +316,7 @@ test("flex_basis_flex_shrink_column", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -315,23 +333,23 @@ test("flex_basis_flex_shrink_column", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_basis_flex_shrink_row", () => {
|
||||
test('flex_basis_flex_shrink_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -343,7 +361,7 @@ test("flex_basis_flex_shrink_row", () => {
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexBasis(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -360,7 +378,7 @@ test("flex_basis_flex_shrink_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -377,19 +395,19 @@ test("flex_basis_flex_shrink_row", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_shrink_to_zero", () => {
|
||||
test('flex_shrink_to_zero', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -410,7 +428,7 @@ test("flex_shrink_to_zero", () => {
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -432,7 +450,7 @@ test("flex_shrink_to_zero", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -454,19 +472,19 @@ test("flex_shrink_to_zero", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_basis_overrides_main_size", () => {
|
||||
test('flex_basis_overrides_main_size', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -488,7 +506,7 @@ test("flex_basis_overrides_main_size", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -510,7 +528,7 @@ test("flex_basis_overrides_main_size", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -532,19 +550,19 @@ test("flex_basis_overrides_main_size", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_grow_shrink_at_most", () => {
|
||||
test('flex_grow_shrink_at_most', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -558,7 +576,7 @@ test("flex_grow_shrink_at_most", () => {
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexShrink(1);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -575,7 +593,7 @@ test("flex_grow_shrink_at_most", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -592,19 +610,19 @@ test("flex_grow_shrink_at_most", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("flex_grow_less_than_factor_one", () => {
|
||||
test('flex_grow_less_than_factor_one', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -623,7 +641,7 @@ test("flex_grow_less_than_factor_one", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setFlexGrow(0.4);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -645,7 +663,7 @@ test("flex_grow_less_than_factor_one", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(200);
|
||||
expect(root_child2.getComputedHeight()).toBe(184);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -667,7 +685,7 @@ test("flex_grow_less_than_factor_one", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(200);
|
||||
expect(root_child2.getComputedHeight()).toBe(184);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,16 +7,34 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||
|
||||
test("justify_content_row_flex_start", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('justify_content_row_flex_start', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -31,7 +49,7 @@ test("justify_content_row_flex_start", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -53,7 +71,7 @@ test("justify_content_row_flex_start", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -75,24 +93,24 @@ test("justify_content_row_flex_start", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_row_flex_end", () => {
|
||||
test('justify_content_row_flex_end', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.FlexEnd);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -107,7 +125,7 @@ test("justify_content_row_flex_end", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -129,7 +147,7 @@ test("justify_content_row_flex_end", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -151,24 +169,24 @@ test("justify_content_row_flex_end", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_row_center", () => {
|
||||
test('justify_content_row_center', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -183,7 +201,7 @@ test("justify_content_row_center", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -205,7 +223,7 @@ test("justify_content_row_center", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -227,24 +245,24 @@ test("justify_content_row_center", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_row_space_between", () => {
|
||||
test('justify_content_row_space_between', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.SpaceBetween);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -259,7 +277,7 @@ test("justify_content_row_space_between", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -281,7 +299,7 @@ test("justify_content_row_space_between", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -303,24 +321,24 @@ test("justify_content_row_space_between", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_row_space_around", () => {
|
||||
test('justify_content_row_space_around', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.SpaceAround);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -335,7 +353,7 @@ test("justify_content_row_space_around", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -357,7 +375,7 @@ test("justify_content_row_space_around", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -379,19 +397,19 @@ test("justify_content_row_space_around", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_column_flex_start", () => {
|
||||
test('justify_content_column_flex_start', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -409,7 +427,7 @@ test("justify_content_column_flex_start", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -431,7 +449,7 @@ test("justify_content_column_flex_start", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -453,23 +471,23 @@ test("justify_content_column_flex_start", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_column_flex_end", () => {
|
||||
test('justify_content_column_flex_end', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
|
||||
root.setJustifyContent(Justify.FlexEnd);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -484,7 +502,7 @@ test("justify_content_column_flex_end", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -506,7 +524,7 @@ test("justify_content_column_flex_end", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -528,23 +546,23 @@ test("justify_content_column_flex_end", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_column_center", () => {
|
||||
test('justify_content_column_center', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -559,7 +577,7 @@ test("justify_content_column_center", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -581,7 +599,7 @@ test("justify_content_column_center", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -603,23 +621,23 @@ test("justify_content_column_center", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_column_space_between", () => {
|
||||
test('justify_content_column_space_between', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN);
|
||||
root.setJustifyContent(Justify.SpaceBetween);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -634,7 +652,7 @@ test("justify_content_column_space_between", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -656,7 +674,7 @@ test("justify_content_column_space_between", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -678,23 +696,23 @@ test("justify_content_column_space_between", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_column_space_around", () => {
|
||||
test('justify_content_column_space_around', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND);
|
||||
root.setJustifyContent(Justify.SpaceAround);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -709,7 +727,7 @@ test("justify_content_column_space_around", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -731,7 +749,7 @@ test("justify_content_column_space_around", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -753,32 +771,32 @@ test("justify_content_column_space_around", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_row_min_width_and_margin", () => {
|
||||
test('justify_content_row_min_width_and_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setMargin(Yoga.EDGE_LEFT, 100);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setMargin(Edge.Left, 100);
|
||||
root.setMinWidth(50);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(100);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -790,7 +808,7 @@ test("justify_content_row_min_width_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(100);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -802,25 +820,25 @@ test("justify_content_row_min_width_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_row_max_width_and_margin", () => {
|
||||
test('justify_content_row_max_width_and_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setMargin(Yoga.EDGE_LEFT, 100);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setMargin(Edge.Left, 100);
|
||||
root.setWidth(100);
|
||||
root.setMaxWidth(80);
|
||||
|
||||
@@ -828,7 +846,7 @@ test("justify_content_row_max_width_and_margin", () => {
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(100);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -840,7 +858,7 @@ test("justify_content_row_max_width_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(100);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -852,31 +870,31 @@ test("justify_content_row_max_width_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_column_min_height_and_margin", () => {
|
||||
test('justify_content_column_min_height_and_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setMargin(Yoga.EDGE_TOP, 100);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setMargin(Edge.Top, 100);
|
||||
root.setMinHeight(50);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(100);
|
||||
@@ -888,7 +906,7 @@ test("justify_content_column_min_height_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(100);
|
||||
@@ -900,24 +918,24 @@ test("justify_content_column_min_height_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_colunn_max_height_and_margin", () => {
|
||||
test('justify_content_colunn_max_height_and_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setMargin(Yoga.EDGE_TOP, 100);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setMargin(Edge.Top, 100);
|
||||
root.setHeight(100);
|
||||
root.setMaxHeight(80);
|
||||
|
||||
@@ -925,7 +943,7 @@ test("justify_content_colunn_max_height_and_margin", () => {
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(100);
|
||||
@@ -937,7 +955,7 @@ test("justify_content_colunn_max_height_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(100);
|
||||
@@ -949,23 +967,23 @@ test("justify_content_colunn_max_height_and_margin", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_column_space_evenly", () => {
|
||||
test('justify_content_column_space_evenly', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY);
|
||||
root.setJustifyContent(Justify.SpaceEvenly);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -980,7 +998,7 @@ test("justify_content_column_space_evenly", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1002,7 +1020,7 @@ test("justify_content_column_space_evenly", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1024,24 +1042,24 @@ test("justify_content_column_space_evenly", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(102);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_row_space_evenly", () => {
|
||||
test('justify_content_row_space_evenly', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.SpaceEvenly);
|
||||
root.setWidth(102);
|
||||
root.setHeight(102);
|
||||
|
||||
@@ -1056,7 +1074,7 @@ test("justify_content_row_space_evenly", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1078,7 +1096,7 @@ test("justify_content_row_space_evenly", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(0);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1100,47 +1118,47 @@ test("justify_content_row_space_evenly", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(0);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_min_width_with_padding_child_width_greater_than_parent", () => {
|
||||
test('justify_content_min_width_with_padding_child_width_greater_than_parent', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setWidth(1000);
|
||||
root.setHeight(1584);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0.setAlignContent(Align.Stretch);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0.setPadding(Yoga.EDGE_LEFT, 100);
|
||||
root_child0_child0.setPadding(Yoga.EDGE_RIGHT, 100);
|
||||
root_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0.setJustifyContent(Justify.Center);
|
||||
root_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0.setPadding(Edge.Left, 100);
|
||||
root_child0_child0.setPadding(Edge.Right, 100);
|
||||
root_child0_child0.setMinWidth(400);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0.setWidth(300);
|
||||
root_child0_child0_child0.setHeight(100);
|
||||
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1162,7 +1180,7 @@ test("justify_content_min_width_with_padding_child_width_greater_than_parent", (
|
||||
expect(root_child0_child0_child0.getComputedWidth()).toBe(300);
|
||||
expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1184,47 +1202,47 @@ test("justify_content_min_width_with_padding_child_width_greater_than_parent", (
|
||||
expect(root_child0_child0_child0.getComputedWidth()).toBe(300);
|
||||
expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("justify_content_min_width_with_padding_child_width_lower_than_parent", () => {
|
||||
test('justify_content_min_width_with_padding_child_width_lower_than_parent', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setWidth(1080);
|
||||
root.setHeight(1584);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0.setAlignContent(Align.Stretch);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0.setPadding(Yoga.EDGE_LEFT, 100);
|
||||
root_child0_child0.setPadding(Yoga.EDGE_RIGHT, 100);
|
||||
root_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0.setJustifyContent(Justify.Center);
|
||||
root_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0.setPadding(Edge.Left, 100);
|
||||
root_child0_child0.setPadding(Edge.Right, 100);
|
||||
root_child0_child0.setMinWidth(400);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH);
|
||||
root_child0_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0_child0.setAlignContent(Align.Stretch);
|
||||
root_child0_child0_child0.setWidth(199);
|
||||
root_child0_child0_child0.setHeight(100);
|
||||
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1246,7 +1264,7 @@ test("justify_content_min_width_with_padding_child_width_lower_than_parent", ()
|
||||
expect(root_child0_child0_child0.getComputedWidth()).toBe(199);
|
||||
expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1268,7 +1286,7 @@ test("justify_content_min_width_with_padding_child_width_lower_than_parent", ()
|
||||
expect(root_child0_child0_child0.getComputedWidth()).toBe(199);
|
||||
expect(root_child0_child0_child0.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,59 +7,77 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||
|
||||
test("padding_no_size", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('padding_no_size', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPadding(Yoga.EDGE_LEFT, 10);
|
||||
root.setPadding(Yoga.EDGE_TOP, 10);
|
||||
root.setPadding(Yoga.EDGE_RIGHT, 10);
|
||||
root.setPadding(Yoga.EDGE_BOTTOM, 10);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.setPadding(Edge.Left, 10);
|
||||
root.setPadding(Edge.Top, 10);
|
||||
root.setPadding(Edge.Right, 10);
|
||||
root.setPadding(Edge.Bottom, 10);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(20);
|
||||
expect(root.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(20);
|
||||
expect(root.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("padding_container_match_child", () => {
|
||||
test('padding_container_match_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPadding(Yoga.EDGE_LEFT, 10);
|
||||
root.setPadding(Yoga.EDGE_TOP, 10);
|
||||
root.setPadding(Yoga.EDGE_RIGHT, 10);
|
||||
root.setPadding(Yoga.EDGE_BOTTOM, 10);
|
||||
root.setPadding(Edge.Left, 10);
|
||||
root.setPadding(Edge.Top, 10);
|
||||
root.setPadding(Edge.Right, 10);
|
||||
root.setPadding(Edge.Bottom, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -71,7 +89,7 @@ test("padding_container_match_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -83,26 +101,26 @@ test("padding_container_match_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("padding_flex_child", () => {
|
||||
test('padding_flex_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPadding(Yoga.EDGE_LEFT, 10);
|
||||
root.setPadding(Yoga.EDGE_TOP, 10);
|
||||
root.setPadding(Yoga.EDGE_RIGHT, 10);
|
||||
root.setPadding(Yoga.EDGE_BOTTOM, 10);
|
||||
root.setPadding(Edge.Left, 10);
|
||||
root.setPadding(Edge.Top, 10);
|
||||
root.setPadding(Edge.Right, 10);
|
||||
root.setPadding(Edge.Bottom, 10);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -110,7 +128,7 @@ test("padding_flex_child", () => {
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setWidth(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -122,7 +140,7 @@ test("padding_flex_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(80);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -134,33 +152,33 @@ test("padding_flex_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(80);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("padding_stretch_child", () => {
|
||||
test('padding_stretch_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPadding(Yoga.EDGE_LEFT, 10);
|
||||
root.setPadding(Yoga.EDGE_TOP, 10);
|
||||
root.setPadding(Yoga.EDGE_RIGHT, 10);
|
||||
root.setPadding(Yoga.EDGE_BOTTOM, 10);
|
||||
root.setPadding(Edge.Left, 10);
|
||||
root.setPadding(Edge.Top, 10);
|
||||
root.setPadding(Edge.Right, 10);
|
||||
root.setPadding(Edge.Bottom, 10);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -172,7 +190,7 @@ test("padding_stretch_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(80);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -184,27 +202,27 @@ test("padding_stretch_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(80);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("padding_center_child", () => {
|
||||
test('padding_center_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setPadding(Yoga.EDGE_START, 10);
|
||||
root.setPadding(Yoga.EDGE_END, 20);
|
||||
root.setPadding(Yoga.EDGE_BOTTOM, 20);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPadding(Edge.Start, 10);
|
||||
root.setPadding(Edge.End, 20);
|
||||
root.setPadding(Edge.Bottom, 20);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -212,7 +230,7 @@ test("padding_center_child", () => {
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -224,7 +242,7 @@ test("padding_center_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -236,36 +254,36 @@ test("padding_center_child", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("child_with_padding_align_end", () => {
|
||||
test('child_with_padding_align_end', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
|
||||
root.setAlignItems(Yoga.ALIGN_FLEX_END);
|
||||
root.setJustifyContent(Justify.FlexEnd);
|
||||
root.setAlignItems(Align.FlexEnd);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPadding(Yoga.EDGE_LEFT, 20);
|
||||
root_child0.setPadding(Yoga.EDGE_TOP, 20);
|
||||
root_child0.setPadding(Yoga.EDGE_RIGHT, 20);
|
||||
root_child0.setPadding(Yoga.EDGE_BOTTOM, 20);
|
||||
root_child0.setPadding(Edge.Left, 20);
|
||||
root_child0.setPadding(Edge.Top, 20);
|
||||
root_child0.setPadding(Edge.Right, 20);
|
||||
root_child0.setPadding(Edge.Bottom, 20);
|
||||
root_child0.setWidth(100);
|
||||
root_child0.setHeight(100);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -277,7 +295,7 @@ test("child_with_padding_align_end", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -289,7 +307,7 @@ test("child_with_padding_align_end", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,16 +7,34 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||
|
||||
test("percentage_width_height", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('percentage_width_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
@@ -24,7 +42,7 @@ test("percentage_width_height", () => {
|
||||
root_child0.setWidth("30%");
|
||||
root_child0.setHeight("30%");
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -36,7 +54,7 @@ test("percentage_width_height", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(60);
|
||||
expect(root_child0.getComputedHeight()).toBe(60);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -48,33 +66,33 @@ test("percentage_width_height", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(60);
|
||||
expect(root_child0.getComputedHeight()).toBe(60);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_position_left_top", () => {
|
||||
test('percentage_position_left_top', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(400);
|
||||
root.setHeight(400);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPosition(Yoga.EDGE_LEFT, "10%");
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, "20%");
|
||||
root_child0.setPosition(Edge.Left, "10%");
|
||||
root_child0.setPosition(Edge.Top, "20%");
|
||||
root_child0.setWidth("45%");
|
||||
root_child0.setHeight("55%");
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -86,7 +104,7 @@ test("percentage_position_left_top", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(180);
|
||||
expect(root_child0.getComputedHeight()).toBe(220);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -98,33 +116,33 @@ test("percentage_position_left_top", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(180);
|
||||
expect(root_child0.getComputedHeight()).toBe(220);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_position_bottom_right", () => {
|
||||
test('percentage_position_bottom_right', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(500);
|
||||
root.setHeight(500);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPosition(Yoga.EDGE_RIGHT, "20%");
|
||||
root_child0.setPosition(Yoga.EDGE_BOTTOM, "10%");
|
||||
root_child0.setPosition(Edge.Right, "20%");
|
||||
root_child0.setPosition(Edge.Bottom, "10%");
|
||||
root_child0.setWidth("55%");
|
||||
root_child0.setHeight("15%");
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -136,7 +154,7 @@ test("percentage_position_bottom_right", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(275);
|
||||
expect(root_child0.getComputedHeight()).toBe(75);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -148,23 +166,23 @@ test("percentage_position_bottom_right", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(275);
|
||||
expect(root_child0.getComputedHeight()).toBe(75);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis", () => {
|
||||
test('percentage_flex_basis', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
@@ -177,7 +195,7 @@ test("percentage_flex_basis", () => {
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setFlexBasis("25%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -194,7 +212,7 @@ test("percentage_flex_basis", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(75);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -211,19 +229,19 @@ test("percentage_flex_basis", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(75);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis_cross", () => {
|
||||
test('percentage_flex_basis_cross', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -239,7 +257,7 @@ test("percentage_flex_basis_cross", () => {
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setFlexBasis("25%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -256,7 +274,7 @@ test("percentage_flex_basis_cross", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(75);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -273,23 +291,85 @@ test("percentage_flex_basis_cross", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(75);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis_main_max_height", () => {
|
||||
test.skip('percentage_flex_basis_cross_min_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMinHeight("60%");
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexGrow(2);
|
||||
root_child1.setMinHeight("10%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(200);
|
||||
expect(root.getComputedHeight()).toBe(200);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0.getComputedHeight()).toBe(120);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(120);
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(80);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(200);
|
||||
expect(root.getComputedHeight()).toBe(200);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0.getComputedHeight()).toBe(120);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(120);
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(80);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('percentage_flex_basis_main_max_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
@@ -304,7 +384,7 @@ test("percentage_flex_basis_main_max_height", () => {
|
||||
root_child1.setFlexBasis("10%");
|
||||
root_child1.setMaxHeight("20%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -321,7 +401,7 @@ test("percentage_flex_basis_main_max_height", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(148);
|
||||
expect(root_child1.getComputedHeight()).toBe(40);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -338,19 +418,19 @@ test("percentage_flex_basis_main_max_height", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(148);
|
||||
expect(root_child1.getComputedHeight()).toBe(40);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis_cross_max_height", () => {
|
||||
test('percentage_flex_basis_cross_max_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -368,7 +448,7 @@ test("percentage_flex_basis_cross_max_height", () => {
|
||||
root_child1.setFlexBasis("10%");
|
||||
root_child1.setMaxHeight("20%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -385,7 +465,7 @@ test("percentage_flex_basis_cross_max_height", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(40);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -402,23 +482,23 @@ test("percentage_flex_basis_cross_max_height", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(40);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis_main_max_width", () => {
|
||||
test('percentage_flex_basis_main_max_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
@@ -433,7 +513,7 @@ test("percentage_flex_basis_main_max_width", () => {
|
||||
root_child1.setFlexBasis("10%");
|
||||
root_child1.setMaxWidth("20%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -450,7 +530,7 @@ test("percentage_flex_basis_main_max_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -467,19 +547,19 @@ test("percentage_flex_basis_main_max_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis_cross_max_width", () => {
|
||||
test('percentage_flex_basis_cross_max_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -497,7 +577,7 @@ test("percentage_flex_basis_cross_max_width", () => {
|
||||
root_child1.setFlexBasis("15%");
|
||||
root_child1.setMaxWidth("20%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -514,7 +594,7 @@ test("percentage_flex_basis_cross_max_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(150);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -531,23 +611,23 @@ test("percentage_flex_basis_cross_max_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(150);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis_main_min_width", () => {
|
||||
test('percentage_flex_basis_main_min_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
@@ -562,7 +642,7 @@ test("percentage_flex_basis_main_min_width", () => {
|
||||
root_child1.setFlexBasis("10%");
|
||||
root_child1.setMinWidth("20%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -579,7 +659,7 @@ test("percentage_flex_basis_main_min_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(80);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -596,19 +676,19 @@ test("percentage_flex_basis_main_min_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(80);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_flex_basis_cross_min_width", () => {
|
||||
test('percentage_flex_basis_cross_min_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -626,7 +706,7 @@ test("percentage_flex_basis_cross_min_width", () => {
|
||||
root_child1.setFlexBasis("15%");
|
||||
root_child1.setMinWidth("20%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -643,7 +723,7 @@ test("percentage_flex_basis_cross_min_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(150);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -660,19 +740,19 @@ test("percentage_flex_basis_cross_min_width", () => {
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(150);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_multiple_nested_with_padding_margin_and_percentage_values", () => {
|
||||
test('percentage_multiple_nested_with_padding_margin_and_percentage_values', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -682,38 +762,38 @@ test("percentage_multiple_nested_with_padding_margin_and_percentage_values", ()
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexBasis("10%");
|
||||
root_child0.setMargin(Yoga.EDGE_LEFT, 5);
|
||||
root_child0.setMargin(Yoga.EDGE_TOP, 5);
|
||||
root_child0.setMargin(Yoga.EDGE_RIGHT, 5);
|
||||
root_child0.setMargin(Yoga.EDGE_BOTTOM, 5);
|
||||
root_child0.setPadding(Yoga.EDGE_LEFT, 3);
|
||||
root_child0.setPadding(Yoga.EDGE_TOP, 3);
|
||||
root_child0.setPadding(Yoga.EDGE_RIGHT, 3);
|
||||
root_child0.setPadding(Yoga.EDGE_BOTTOM, 3);
|
||||
root_child0.setMargin(Edge.Left, 5);
|
||||
root_child0.setMargin(Edge.Top, 5);
|
||||
root_child0.setMargin(Edge.Right, 5);
|
||||
root_child0.setMargin(Edge.Bottom, 5);
|
||||
root_child0.setPadding(Edge.Left, 3);
|
||||
root_child0.setPadding(Edge.Top, 3);
|
||||
root_child0.setPadding(Edge.Right, 3);
|
||||
root_child0.setPadding(Edge.Bottom, 3);
|
||||
root_child0.setMinWidth("60%");
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setMargin(Yoga.EDGE_LEFT, 5);
|
||||
root_child0_child0.setMargin(Yoga.EDGE_TOP, 5);
|
||||
root_child0_child0.setMargin(Yoga.EDGE_RIGHT, 5);
|
||||
root_child0_child0.setMargin(Yoga.EDGE_BOTTOM, 5);
|
||||
root_child0_child0.setPadding(Yoga.EDGE_LEFT, "3%");
|
||||
root_child0_child0.setPadding(Yoga.EDGE_TOP, "3%");
|
||||
root_child0_child0.setPadding(Yoga.EDGE_RIGHT, "3%");
|
||||
root_child0_child0.setPadding(Yoga.EDGE_BOTTOM, "3%");
|
||||
root_child0_child0.setMargin(Edge.Left, 5);
|
||||
root_child0_child0.setMargin(Edge.Top, 5);
|
||||
root_child0_child0.setMargin(Edge.Right, 5);
|
||||
root_child0_child0.setMargin(Edge.Bottom, 5);
|
||||
root_child0_child0.setPadding(Edge.Left, "3%");
|
||||
root_child0_child0.setPadding(Edge.Top, "3%");
|
||||
root_child0_child0.setPadding(Edge.Right, "3%");
|
||||
root_child0_child0.setPadding(Edge.Bottom, "3%");
|
||||
root_child0_child0.setWidth("50%");
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0.setMargin(Yoga.EDGE_LEFT, "5%");
|
||||
root_child0_child0_child0.setMargin(Yoga.EDGE_TOP, "5%");
|
||||
root_child0_child0_child0.setMargin(Yoga.EDGE_RIGHT, "5%");
|
||||
root_child0_child0_child0.setMargin(Yoga.EDGE_BOTTOM, "5%");
|
||||
root_child0_child0_child0.setPadding(Yoga.EDGE_LEFT, 3);
|
||||
root_child0_child0_child0.setPadding(Yoga.EDGE_TOP, 3);
|
||||
root_child0_child0_child0.setPadding(Yoga.EDGE_RIGHT, 3);
|
||||
root_child0_child0_child0.setPadding(Yoga.EDGE_BOTTOM, 3);
|
||||
root_child0_child0_child0.setMargin(Edge.Left, "5%");
|
||||
root_child0_child0_child0.setMargin(Edge.Top, "5%");
|
||||
root_child0_child0_child0.setMargin(Edge.Right, "5%");
|
||||
root_child0_child0_child0.setMargin(Edge.Bottom, "5%");
|
||||
root_child0_child0_child0.setPadding(Edge.Left, 3);
|
||||
root_child0_child0_child0.setPadding(Edge.Top, 3);
|
||||
root_child0_child0_child0.setPadding(Edge.Right, 3);
|
||||
root_child0_child0_child0.setPadding(Edge.Bottom, 3);
|
||||
root_child0_child0_child0.setWidth("45%");
|
||||
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||
|
||||
@@ -722,7 +802,7 @@ test("percentage_multiple_nested_with_padding_margin_and_percentage_values", ()
|
||||
root_child1.setFlexBasis("15%");
|
||||
root_child1.setMinWidth("20%");
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -749,7 +829,7 @@ test("percentage_multiple_nested_with_padding_margin_and_percentage_values", ()
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(142);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -776,19 +856,19 @@ test("percentage_multiple_nested_with_padding_margin_and_percentage_values", ()
|
||||
expect(root_child1.getComputedWidth()).toBe(200);
|
||||
expect(root_child1.getComputedHeight()).toBe(142);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_margin_should_calculate_based_only_on_width", () => {
|
||||
test('percentage_margin_should_calculate_based_only_on_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -797,17 +877,17 @@ test("percentage_margin_should_calculate_based_only_on_width", () => {
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMargin(Yoga.EDGE_LEFT, "10%");
|
||||
root_child0.setMargin(Yoga.EDGE_TOP, "10%");
|
||||
root_child0.setMargin(Yoga.EDGE_RIGHT, "10%");
|
||||
root_child0.setMargin(Yoga.EDGE_BOTTOM, "10%");
|
||||
root_child0.setMargin(Edge.Left, "10%");
|
||||
root_child0.setMargin(Edge.Top, "10%");
|
||||
root_child0.setMargin(Edge.Right, "10%");
|
||||
root_child0.setMargin(Edge.Bottom, "10%");
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setWidth(10);
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -824,7 +904,7 @@ test("percentage_margin_should_calculate_based_only_on_width", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -841,19 +921,19 @@ test("percentage_margin_should_calculate_based_only_on_width", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_padding_should_calculate_based_only_on_width", () => {
|
||||
test('percentage_padding_should_calculate_based_only_on_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -862,17 +942,17 @@ test("percentage_padding_should_calculate_based_only_on_width", () => {
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setPadding(Yoga.EDGE_LEFT, "10%");
|
||||
root_child0.setPadding(Yoga.EDGE_TOP, "10%");
|
||||
root_child0.setPadding(Yoga.EDGE_RIGHT, "10%");
|
||||
root_child0.setPadding(Yoga.EDGE_BOTTOM, "10%");
|
||||
root_child0.setPadding(Edge.Left, "10%");
|
||||
root_child0.setPadding(Edge.Top, "10%");
|
||||
root_child0.setPadding(Edge.Right, "10%");
|
||||
root_child0.setPadding(Edge.Bottom, "10%");
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setWidth(10);
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -889,7 +969,7 @@ test("percentage_padding_should_calculate_based_only_on_width", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -906,19 +986,19 @@ test("percentage_padding_should_calculate_based_only_on_width", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_absolute_position", () => {
|
||||
test('percentage_absolute_position', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -926,13 +1006,13 @@ test("percentage_absolute_position", () => {
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_LEFT, "30%");
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, "10%");
|
||||
root_child0.setPositionType(PositionType.Absolute);
|
||||
root_child0.setPosition(Edge.Left, "30%");
|
||||
root_child0.setPosition(Edge.Top, "10%");
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -944,7 +1024,7 @@ test("percentage_absolute_position", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -956,19 +1036,19 @@ test("percentage_absolute_position", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_width_height_undefined_parent_size", () => {
|
||||
test('percentage_width_height_undefined_parent_size', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -977,7 +1057,7 @@ test("percentage_width_height_undefined_parent_size", () => {
|
||||
root_child0.setWidth("50%");
|
||||
root_child0.setHeight("50%");
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -989,7 +1069,7 @@ test("percentage_width_height_undefined_parent_size", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1001,23 +1081,23 @@ test("percentage_width_height_undefined_parent_size", () => {
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percent_within_flex_grow", () => {
|
||||
test('percent_within_flex_grow', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(350);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -1036,7 +1116,7 @@ test("percent_within_flex_grow", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(100);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1063,7 +1143,7 @@ test("percent_within_flex_grow", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1090,24 +1170,24 @@ test("percent_within_flex_grow", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percentage_container_in_wrapping_container", () => {
|
||||
test('percentage_container_in_wrapping_container', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
@@ -1115,8 +1195,8 @@ test("percentage_container_in_wrapping_container", () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0_child0.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root_child0_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0_child0.setJustifyContent(Justify.Center);
|
||||
root_child0_child0.setWidth("100%");
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
@@ -1129,7 +1209,7 @@ test("percentage_container_in_wrapping_container", () => {
|
||||
root_child0_child0_child1.setWidth(50);
|
||||
root_child0_child0_child1.setHeight(50);
|
||||
root_child0_child0.insertChild(root_child0_child0_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1156,7 +1236,7 @@ test("percentage_container_in_wrapping_container", () => {
|
||||
expect(root_child0_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1183,19 +1263,19 @@ test("percentage_container_in_wrapping_container", () => {
|
||||
expect(root_child0_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0_child1.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("percent_absolute_position", () => {
|
||||
test('percent_absolute_position', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -1203,9 +1283,9 @@ test("percent_absolute_position", () => {
|
||||
root.setHeight(50);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_LEFT, "50%");
|
||||
root_child0.setFlexDirection(FlexDirection.Row);
|
||||
root_child0.setPositionType(PositionType.Absolute);
|
||||
root_child0.setPosition(Edge.Left, "50%");
|
||||
root_child0.setWidth("100%");
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
@@ -1217,7 +1297,7 @@ test("percent_absolute_position", () => {
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setWidth("100%");
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1239,7 +1319,7 @@ test("percent_absolute_position", () => {
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(60);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1261,7 +1341,7 @@ test("percent_absolute_position", () => {
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(60);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,16 +7,34 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
|
||||
test("rounding_flex_basis_flex_grow_row_width_of_100", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('rounding_flex_basis_flex_grow_row_width_of_100', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -31,7 +49,7 @@ test("rounding_flex_basis_flex_grow_row_width_of_100", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setFlexGrow(1);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -53,7 +71,7 @@ test("rounding_flex_basis_flex_grow_row_width_of_100", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(33);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -75,23 +93,23 @@ test("rounding_flex_basis_flex_grow_row_width_of_100", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(33);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_flex_basis_flex_grow_row_prime_number_width", () => {
|
||||
test('rounding_flex_basis_flex_grow_row_prime_number_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(113);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -114,7 +132,7 @@ test("rounding_flex_basis_flex_grow_row_prime_number_width", () => {
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setFlexGrow(1);
|
||||
root.insertChild(root_child4, 4);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -146,7 +164,7 @@ test("rounding_flex_basis_flex_grow_row_prime_number_width", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(23);
|
||||
expect(root_child4.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -178,23 +196,23 @@ test("rounding_flex_basis_flex_grow_row_prime_number_width", () => {
|
||||
expect(root_child4.getComputedWidth()).toBe(23);
|
||||
expect(root_child4.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_flex_basis_flex_shrink_row", () => {
|
||||
test('rounding_flex_basis_flex_shrink_row', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(101);
|
||||
root.setHeight(100);
|
||||
|
||||
@@ -210,7 +228,7 @@ test("rounding_flex_basis_flex_shrink_row", () => {
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setFlexBasis(25);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -232,7 +250,7 @@ test("rounding_flex_basis_flex_shrink_row", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(25);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -254,19 +272,19 @@ test("rounding_flex_basis_flex_shrink_row", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(25);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_flex_basis_overrides_main_size", () => {
|
||||
test('rounding_flex_basis_overrides_main_size', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -288,7 +306,7 @@ test("rounding_flex_basis_overrides_main_size", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -310,7 +328,7 @@ test("rounding_flex_basis_overrides_main_size", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -332,19 +350,19 @@ test("rounding_flex_basis_overrides_main_size", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_total_fractial", () => {
|
||||
test('rounding_total_fractial', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -366,7 +384,7 @@ test("rounding_total_fractial", () => {
|
||||
root_child2.setFlexGrow(1.1);
|
||||
root_child2.setHeight(10.7);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -388,7 +406,7 @@ test("rounding_total_fractial", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(87);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -410,19 +428,19 @@ test("rounding_total_fractial", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(87);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_total_fractial_nested", () => {
|
||||
test('rounding_total_fractial_nested', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -438,14 +456,14 @@ test("rounding_total_fractial_nested", () => {
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexBasis(0.3);
|
||||
root_child0_child0.setPosition(Yoga.EDGE_BOTTOM, 13.3);
|
||||
root_child0_child0.setPosition(Edge.Bottom, 13.3);
|
||||
root_child0_child0.setHeight(9.9);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setFlexGrow(4);
|
||||
root_child0_child1.setFlexBasis(0.3);
|
||||
root_child0_child1.setPosition(Yoga.EDGE_TOP, 13.3);
|
||||
root_child0_child1.setPosition(Edge.Top, 13.3);
|
||||
root_child0_child1.setHeight(1.1);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
|
||||
@@ -458,7 +476,7 @@ test("rounding_total_fractial_nested", () => {
|
||||
root_child2.setFlexGrow(1.1);
|
||||
root_child2.setHeight(10.7);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -490,7 +508,7 @@ test("rounding_total_fractial_nested", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(87);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -522,19 +540,19 @@ test("rounding_total_fractial_nested", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(87);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_fractial_input_1", () => {
|
||||
test('rounding_fractial_input_1', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -556,7 +574,7 @@ test("rounding_fractial_input_1", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -578,7 +596,7 @@ test("rounding_fractial_input_1", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -600,19 +618,19 @@ test("rounding_fractial_input_1", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_fractial_input_2", () => {
|
||||
test('rounding_fractial_input_2', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -634,7 +652,7 @@ test("rounding_fractial_input_2", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -656,7 +674,7 @@ test("rounding_fractial_input_2", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(25);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -678,23 +696,23 @@ test("rounding_fractial_input_2", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(25);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_fractial_input_3", () => {
|
||||
test('rounding_fractial_input_3', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPosition(Yoga.EDGE_TOP, 0.3);
|
||||
root.setPosition(Edge.Top, 0.3);
|
||||
root.setWidth(100);
|
||||
root.setHeight(113.4);
|
||||
|
||||
@@ -713,7 +731,7 @@ test("rounding_fractial_input_3", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -735,7 +753,7 @@ test("rounding_fractial_input_3", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(25);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -757,23 +775,23 @@ test("rounding_fractial_input_3", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(25);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_fractial_input_4", () => {
|
||||
test('rounding_fractial_input_4', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPosition(Yoga.EDGE_TOP, 0.7);
|
||||
root.setPosition(Edge.Top, 0.7);
|
||||
root.setWidth(100);
|
||||
root.setHeight(113.4);
|
||||
|
||||
@@ -792,7 +810,7 @@ test("rounding_fractial_input_4", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(1);
|
||||
@@ -814,7 +832,7 @@ test("rounding_fractial_input_4", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(1);
|
||||
@@ -836,23 +854,23 @@ test("rounding_fractial_input_4", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(100);
|
||||
expect(root_child2.getComputedHeight()).toBe(24);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_inner_node_controversy_horizontal", () => {
|
||||
test('rounding_inner_node_controversy_horizontal', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(320);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
@@ -874,7 +892,7 @@ test("rounding_inner_node_controversy_horizontal", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -901,7 +919,7 @@ test("rounding_inner_node_controversy_horizontal", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(107);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -928,19 +946,19 @@ test("rounding_inner_node_controversy_horizontal", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(107);
|
||||
expect(root_child2.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_inner_node_controversy_vertical", () => {
|
||||
test('rounding_inner_node_controversy_vertical', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -965,7 +983,7 @@ test("rounding_inner_node_controversy_vertical", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setWidth(10);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -992,7 +1010,7 @@ test("rounding_inner_node_controversy_vertical", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(107);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1019,23 +1037,23 @@ test("rounding_inner_node_controversy_vertical", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(10);
|
||||
expect(root_child2.getComputedHeight()).toBe(107);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("rounding_inner_node_controversy_combined", () => {
|
||||
test('rounding_inner_node_controversy_combined', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setWidth(640);
|
||||
root.setHeight(320);
|
||||
|
||||
@@ -1073,7 +1091,7 @@ test("rounding_inner_node_controversy_combined", () => {
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setHeight("100%");
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1115,7 +1133,7 @@ test("rounding_inner_node_controversy_combined", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(213);
|
||||
expect(root_child2.getComputedHeight()).toBe(320);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -1157,7 +1175,7 @@ test("rounding_inner_node_controversy_combined", () => {
|
||||
expect(root_child2.getComputedWidth()).toBe(213);
|
||||
expect(root_child2.getComputedHeight()).toBe(320);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -7,12 +7,30 @@
|
||||
|
||||
// @generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
||||
|
||||
test("nested_overflowing_child", () => {
|
||||
import {Yoga} from "../tools/globals";
|
||||
import {
|
||||
Align,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('nested_overflowing_child', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -26,7 +44,7 @@ test("nested_overflowing_child", () => {
|
||||
root_child0_child0.setWidth(200);
|
||||
root_child0_child0.setHeight(200);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -43,7 +61,7 @@ test("nested_overflowing_child", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(200);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -60,19 +78,19 @@ test("nested_overflowing_child", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("nested_overflowing_child_in_constraint_parent", () => {
|
||||
test('nested_overflowing_child_in_constraint_parent', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -88,7 +106,7 @@ test("nested_overflowing_child_in_constraint_parent", () => {
|
||||
root_child0_child0.setWidth(200);
|
||||
root_child0_child0.setHeight(200);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -105,7 +123,7 @@ test("nested_overflowing_child_in_constraint_parent", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(200);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -122,19 +140,19 @@ test("nested_overflowing_child_in_constraint_parent", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test("parent_wrap_child_size_overflowing_parent", () => {
|
||||
test('parent_wrap_child_size_overflowing_parent', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||
config.setExperimentalFeatureEnabled(ExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
@@ -149,7 +167,7 @@ test("parent_wrap_child_size_overflowing_parent", () => {
|
||||
root_child0_child0.setWidth(100);
|
||||
root_child0_child0.setHeight(200);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -166,7 +184,7 @@ test("parent_wrap_child_size_overflowing_parent", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(200);
|
||||
|
||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
@@ -183,7 +201,7 @@ test("parent_wrap_child_size_overflowing_parent", () => {
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(100);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
if (typeof root !== "undefined") {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
@@ -1262,6 +1262,8 @@ TEST(YogaTest, align_baseline_multiline) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_baseline_multiline_column) {
|
||||
GTEST_SKIP();
|
||||
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
@@ -1350,7 +1352,7 @@ TEST(YogaTest, align_baseline_multiline_column) {
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
|
||||
@@ -1360,7 +1362,7 @@ TEST(YogaTest, align_baseline_multiline_column) {
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child1_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetHeight(root_child2));
|
||||
@@ -1381,6 +1383,8 @@ TEST(YogaTest, align_baseline_multiline_column) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_baseline_multiline_column2) {
|
||||
GTEST_SKIP();
|
||||
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
@@ -1469,7 +1473,7 @@ TEST(YogaTest, align_baseline_multiline_column2) {
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
|
||||
@@ -1479,7 +1483,7 @@ TEST(YogaTest, align_baseline_multiline_column2) {
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child1_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child2));
|
||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetHeight(root_child2));
|
||||
|
@@ -96,6 +96,123 @@ TEST(YogaTest, max_height) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_height) {
|
||||
GTEST_SKIP();
|
||||
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinHeight(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_width) {
|
||||
GTEST_SKIP();
|
||||
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinWidth(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, justify_content_min_max) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
@@ -259,6 +259,65 @@ TEST(YogaTest, percentage_flex_basis_cross) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_cross_min_height) {
|
||||
GTEST_SKIP();
|
||||
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureFixAbsoluteTrailingColumnMargin, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinHeightPercent(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 2);
|
||||
YGNodeStyleSetMinHeightPercent(root_child1, 10);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, percentage_flex_basis_main_max_height) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||
|
Reference in New Issue
Block a user