Compare commits
70 Commits
v3.1.0
...
export-D70
Author | SHA1 | Date | |
---|---|---|---|
|
7305a5f7c8 | ||
|
1b7d2c8d48 | ||
|
3aa594c1f9 | ||
|
c2ae39167e | ||
|
49ee855f99 | ||
|
b12e0a2a15 | ||
|
9591210a7a | ||
|
91997d6cd3 | ||
|
909e4bea6e | ||
|
13f4adbbcd | ||
|
ae2d06d0f5 | ||
|
5478812db3 | ||
|
050ac8a413 | ||
|
733ba24064 | ||
|
e177477144 | ||
|
76ffdbc25d | ||
|
f99e657acd | ||
|
a9246bc7db | ||
|
be72b8e8aa | ||
|
b876f596d9 | ||
|
be00354b71 | ||
|
0c995496c8 | ||
|
c12e732fab | ||
|
0b25796676 | ||
|
262f868ce0 | ||
|
77c9987012 | ||
|
26b21ae23c | ||
|
5b962c0801 | ||
|
8f69ac776e | ||
|
867bfae3a3 | ||
|
488288e291 | ||
|
f52ec78584 | ||
|
6fed4dfe30 | ||
|
8dc2fa52c1 | ||
|
e696b8c456 | ||
|
68bb2343d2 | ||
|
568718242d | ||
|
43be5888c4 | ||
|
2437d26ca5 | ||
|
820a4d5bf6 | ||
|
ef9ae63268 | ||
|
e69fcb26bb | ||
|
990ec920ad | ||
|
3351e8eb45 | ||
|
84312c54a4 | ||
|
dc1f0a68f9 | ||
|
bc236947d0 | ||
|
671ae61a39 | ||
|
bc5098fc80 | ||
|
b02caa8e06 | ||
|
22b018c957 | ||
|
c722caa6b2 | ||
|
8277df7e1f | ||
|
43d920eab0 | ||
|
6212e561ad | ||
|
a112a07e6a | ||
|
dc4ab5ad57 | ||
|
6d6f69bee7 | ||
|
596f8dff3c | ||
|
ae8ede9b53 | ||
|
5009f5c1ac | ||
|
e4fe14ab3e | ||
|
a1e9abb9b3 | ||
|
b9e335ebfd | ||
|
1a3bc6bfbc | ||
|
0888b20098 | ||
|
53e4421178 | ||
|
db383714d3 | ||
|
7970b972e5 | ||
|
1f7faf4c61 |
23
.github/actions/clang-format/action.yml
vendored
23
.github/actions/clang-format/action.yml
vendored
@@ -1,23 +0,0 @@
|
||||
name: Clang Format
|
||||
inputs:
|
||||
directory:
|
||||
description: Directory to Lint
|
||||
required: true
|
||||
version:
|
||||
description: LLVM version to use # Should be kept roughly in sync with arcanist
|
||||
required: false
|
||||
default: 12
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install
|
||||
shell: bash
|
||||
run: sudo apt-get install -y clang-format-${{ inputs.version }}
|
||||
|
||||
- name: clang-format
|
||||
working-directory: ${{ inputs.directory }}
|
||||
shell: bash
|
||||
env:
|
||||
BASHOPTS: extglob:nullglob
|
||||
run: clang-format-${{ inputs.version }} --dry-run --Werror **/*.{h,hh,hpp,c,cpp,cc,m,mm}
|
1
.github/actions/setup-cpp/action.yml
vendored
1
.github/actions/setup-cpp/action.yml
vendored
@@ -16,6 +16,7 @@ runs:
|
||||
if: ${{ inputs.toolchain == 'Clang' }}
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get install -y libc++-dev libc++abi-dev
|
||||
echo "CC=/usr/bin/clang" >> $GITHUB_ENV
|
||||
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
|
||||
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
|
||||
|
2
.github/actions/setup-js/action.yml
vendored
2
.github/actions/setup-js/action.yml
vendored
@@ -6,7 +6,7 @@ runs:
|
||||
- name: Setup Node environment
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
node-version: 20.x
|
||||
cache: yarn
|
||||
cache-dependency-path: yarn.lock
|
||||
env:
|
||||
|
@@ -24,7 +24,7 @@ jobs:
|
||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||
|
||||
- name: Upload Build Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 'snapshot-artifacts'
|
||||
path: '~/.m2/repository/'
|
||||
|
@@ -23,7 +23,7 @@ jobs:
|
||||
ORG_GRADLE_PROJECT_USE_SNAPSHOT: true
|
||||
|
||||
- name: Upload Build Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 'snapshot-artifacts'
|
||||
path: '~/.m2/repository/'
|
||||
|
10
.github/workflows/validate-cpp.yml
vendored
10
.github/workflows/validate-cpp.yml
vendored
@@ -97,13 +97,3 @@ jobs:
|
||||
cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release
|
||||
cmake --build build
|
||||
working-directory: capture
|
||||
|
||||
clang-format:
|
||||
name: Format
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: clang-format
|
||||
uses: ./.github/actions/clang-format
|
||||
|
2
.github/workflows/validate-js.yml
vendored
2
.github/workflows/validate-js.yml
vendored
@@ -110,7 +110,7 @@ jobs:
|
||||
run: yarn pack --filename yoga-layout.tar.gz
|
||||
working-directory: javascript
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: npm-package
|
||||
path: javascript/yoga-layout.tar.gz
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Yoga [](https://opensource.fb.com/support-ukraine) [](http://cocoapods.org/pods/Yoga) [](https://www.npmjs.com/package/yoga-layout) [](https://search.maven.org/artifact/com.facebook.yoga/yoga)
|
||||
# Yoga [](http://cocoapods.org/pods/Yoga) [](https://www.npmjs.com/package/yoga-layout) [](https://search.maven.org/artifact/com.facebook.yoga/yoga) 
|
||||
|
||||
Yoga is an embeddable and performant flexbox layout engine with bindings for multiple languages.
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'Yoga'
|
||||
spec.version = '3.1.0'
|
||||
spec.version = '0.0.0'
|
||||
spec.license = { :type => 'MIT', :file => "LICENSE" }
|
||||
spec.homepage = 'https://yogalayout.dev/'
|
||||
spec.documentation_url = 'https://yogalayout.dev/docs'
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("com.android.library") version "8.2.1" apply false
|
||||
id("com.android.application") version "8.2.1" apply false
|
||||
id("com.android.library") version "8.7.1" apply false
|
||||
id("com.android.application") version "8.7.1" apply false
|
||||
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
|
||||
}
|
||||
|
||||
|
@@ -225,17 +225,17 @@ static void serializeTreeImpl(
|
||||
appendEdges<&YGNodeStyleGetPosition>(
|
||||
j, "position", node, defaultNode.get());
|
||||
|
||||
appendFloatIfNotDefault(
|
||||
appendYGValueIfNotDefault(
|
||||
j["style"],
|
||||
"gap",
|
||||
YGNodeStyleGetGap(node, YGGutterAll),
|
||||
YGNodeStyleGetGap(defaultNode.get(), YGGutterAll));
|
||||
appendFloatIfNotDefault(
|
||||
appendYGValueIfNotDefault(
|
||||
j["style"],
|
||||
"column-gap",
|
||||
YGNodeStyleGetGap(node, YGGutterColumn),
|
||||
YGNodeStyleGetGap(defaultNode.get(), YGGutterColumn));
|
||||
appendFloatIfNotDefault(
|
||||
appendYGValueIfNotDefault(
|
||||
j["style"],
|
||||
"row-gap",
|
||||
YGNodeStyleGetGap(node, YGGutterRow),
|
||||
|
@@ -19,8 +19,8 @@ add_compile_options(
|
||||
# Enable warnings and warnings as errors
|
||||
/W4
|
||||
/WX
|
||||
# Disable RTTI
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/GR->
|
||||
# Enable RTTI
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/GR>
|
||||
# Use /O2 (Maximize Speed)
|
||||
$<$<CONFIG:RELEASE>:/O2>)
|
||||
|
||||
@@ -34,8 +34,8 @@ add_compile_options(
|
||||
# Enable warnings and warnings as errors
|
||||
-Wall
|
||||
-Werror
|
||||
# Disable RTTI
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
||||
# Enable RTTI
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-frtti>
|
||||
# Use -O2 (prioritize speed)
|
||||
$<$<CONFIG:RELEASE>:-O2>
|
||||
# Enable separate sections per function/data item
|
||||
|
21
enums.py
21
enums.py
@@ -4,12 +4,19 @@
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
import math
|
||||
import os
|
||||
|
||||
ENUMS = {
|
||||
"Direction": ["Inherit", "LTR", "RTL"],
|
||||
"Unit": ["Undefined", "Point", "Percent", "Auto"],
|
||||
"Unit": [
|
||||
"Undefined",
|
||||
"Point",
|
||||
"Percent",
|
||||
"Auto",
|
||||
"MaxContent",
|
||||
"FitContent",
|
||||
"Stretch",
|
||||
],
|
||||
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
|
||||
"Justify": [
|
||||
"FlexStart",
|
||||
@@ -32,8 +39,9 @@ ENUMS = {
|
||||
"SpaceEvenly",
|
||||
],
|
||||
"PositionType": ["Static", "Relative", "Absolute"],
|
||||
"Display": ["Flex", "None"],
|
||||
"Display": ["Flex", "None", "Contents"],
|
||||
"Wrap": ["NoWrap", "Wrap", "WrapReverse"],
|
||||
"BoxSizing": ["BorderBox", "ContentBox"],
|
||||
"MeasureMode": ["Undefined", "Exactly", "AtMost"],
|
||||
"Dimension": ["Width", "Height"],
|
||||
"Edge": [
|
||||
@@ -61,9 +69,10 @@ ENUMS = {
|
||||
# Allows main-axis flex basis to be stretched without flexGrow being
|
||||
# set (previously referred to as "UseLegacyStretchBehaviour")
|
||||
("StretchFlexBasis", 1 << 0),
|
||||
# Positioning of absolute nodes will have various bugs related to
|
||||
# justification, alignment, and insets
|
||||
("AbsolutePositioningIncorrect", 1 << 1),
|
||||
# Absolute position in a given axis will be relative to the padding
|
||||
# edge of the parent container instead of the content edge when a
|
||||
# specific inset (top/bottom/left/right) is not set.
|
||||
("AbsolutePositionWithoutInsetsExcludesPadding", 1 << 1),
|
||||
# Absolute nodes will resolve percentages against the inner size of
|
||||
# their containing node, not the padding box
|
||||
("AbsolutePercentAgainstInnerSize", 1 << 2),
|
||||
|
@@ -2,6 +2,18 @@
|
||||
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_left_auto_right" style="width: 100px; height: 100px">
|
||||
<div style="width: 10px; height: 10px; position: absolute; left: auto; right: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_left_right_auto" style="width: 100px; height: 100px">
|
||||
<div style="width: 10px; height: 10px; position: absolute; left: 10px; right: auto;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_left_auto_right_auto" style="width: 100px; height: 100px">
|
||||
<div style="width: 10px; height: 10px; position: absolute; left: auto; right: auto;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_end_bottom" style="width: 100px; height: 100px;">
|
||||
<div style="width:10px; height: 10px; position: absolute; end: 10px; bottom: 10px;"></div>
|
||||
</div>
|
||||
|
@@ -448,3 +448,32 @@
|
||||
</div>
|
||||
<div style="height: 50px; width: 50px; margin-left: 20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_stretch_and_align_items_flex_end_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: flex-end;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-start;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="align_content_stretch_and_align_items_flex_start_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: flex-start;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_stretch_and_align_items_center_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: center;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_stretch_and_align_items_stretch_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: stretch;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
@@ -2,10 +2,10 @@
|
||||
<div id="aspect_ratio_does_not_stretch_cross_axis_dim" data-disabled="true" style="width: 300px; height: 300px;">
|
||||
<div style="flex: 1; overflow: scroll;">
|
||||
<div style="flex-direction: row;">
|
||||
<div style="flex: 2; aspect-ratio: 1;"></div>
|
||||
<div style="width: 5px"></div>
|
||||
<div style="flex: 1">
|
||||
<div style="flex: 1; aspect-ratio: 1;">
|
||||
<div style="flex: 2; aspect-ratio: 1;"></div>
|
||||
<div style="width: 5px"></div>
|
||||
<div style="flex: 1">
|
||||
<div style="flex: 1; aspect-ratio: 1;">
|
||||
<div style="width: 5px"></div>
|
||||
<div style="flex: 1; aspect-ratio: 1;"></div>
|
||||
</div>
|
||||
@@ -13,3 +13,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="zero_aspect_ratio_behaves_like_auto" style="width: 300px; height: 300px;">
|
||||
<div style="aspect-ratio: 0; width: 50px"></div>
|
||||
</div>
|
||||
|
25
gentest/fixtures/YGAutoTest.html
Normal file
25
gentest/fixtures/YGAutoTest.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<div id="auto_width" style="width: auto; height: 50px; flex-direction: row;">
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_height" style="width: 50px; height: auto;">
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_flex_basis" style="width: 50px; flex-basis: auto;">
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_position" style="width: 50px; height: 50px;">
|
||||
<div style="width: 25px; height: 25px; right: auto"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_margin" style="width: 50px; height: 50px;">
|
||||
<div style="width: 25px; height: 25px; margin-left: auto"></div>
|
||||
</div>
|
252
gentest/fixtures/YGBoxSizingTest.html
Normal file
252
gentest/fixtures/YGBoxSizingTest.html
Normal file
@@ -0,0 +1,252 @@
|
||||
<div id="box_sizing_content_box_simple"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_simple"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 25%; padding: 4px; border-width: 16px; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 25%; padding: 4px; border-width: 16px; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_absolute" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50; height: 25%; padding: 12px; border-width: 8px; box-sizing: content-box; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_absolute" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50; height: 25%; padding: 12px; border-width: 8px; box-sizing: border-box; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_comtaining_block"
|
||||
style="width: 100px; height: 100px; padding: 12px; border-width: 8px; box-sizing: content-box; ">
|
||||
<div style="width: 75; height: 75; position: static;">
|
||||
<div style="width: 50px; height: 25%; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_comtaining_block"
|
||||
style="width: 100px; height: 100px; padding: 12px; border-width: 8px; box-sizing: border-box; ">
|
||||
<div style="width: 75; height: 75; position: static;">
|
||||
<div style="width: 50px; height: 25%; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_only"
|
||||
style="width: 100px; height: 100px; padding: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_only_percent" style="width: 100px; height: 150px;">
|
||||
<div style="width: 50px; height: 75px; padding: 10%; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_only" style="width: 100px; height: 100px; padding: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_only_percent" style="width: 100px; height: 150px;">
|
||||
<div style="width: 50px; height: 75px; padding: 10%; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_only"
|
||||
style="width: 100px; height: 100px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_only_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 75; border-width: 10%; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_only"
|
||||
style="width: 100px; height: 100px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_only_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 75; border-width: 10%; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_no_padding_no_border" style="width: 100px; height: 100px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_no_padding_no_border" style="width: 100px; height: 100px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_children"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_children"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_siblings" style="width: 100px; height: 100px;">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px; box-sizing: content-box; padding: 10px; border-width: 10px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_siblings" style="width: 100px; height: 100px;">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px; box-sizing: border-box; padding: 10px; border-width: 10px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_max_width" style="width: 100px; height: 100px;">
|
||||
<div style="max-width: 50px; height: 25px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_max_width" style="width: 100px; height: 100px;">
|
||||
<div style="max-width: 50px; height: 25px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_max_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; max-height: 50px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_max_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; max-height: 50px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_min_width" style="width: 100px; height: 100px;">
|
||||
<div style="min-width: 50px; height: 25px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_min_width" style="width: 100px; height: 100px;">
|
||||
<div style="min-width: 50px; height: 25px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_min_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; min-height: 50px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_min_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; min-height: 50px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_no_height_no_width" style="width: 100px; height: 100px;">
|
||||
<div style="box-sizing: content-box; padding: 2px; border-width: 7px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_no_height_no_width" style="width: 100px; height: 100px;">
|
||||
<div style="box-sizing: border-box; padding: 2px; border-width: 7px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_nested"
|
||||
style="width: 100px; height: 100px; box-sizing: content-box; padding: 15px; border-width: 3px;">
|
||||
<div style="width: 20px; height: 20px; box-sizing: content-box; padding: 2px; border-width: 7px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: content-box; padding: 1px; border-width: 2px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_nested"
|
||||
style="width: 100px; height: 100px; box-sizing: border-box; padding: 15px; border-width: 3px;">
|
||||
<div style="width: 20px; height: 20px; box-sizing: border-box; padding: 2px; border-width: 7px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: border-box; padding: 1px; border-width: 2px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_nested_alternating"
|
||||
style="width: 100px; height: 100px; box-sizing: content-box; padding: 3px; border-width: 2px;">
|
||||
<div style="width: 40px; height: 40px; box-sizing: border-box; padding: 8px; border-width: 2px">
|
||||
<div style="width: 20px; height: 25px; box-sizing: content-box; padding: 3px; border-width: 6px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: border-box; padding: 1px; border-width: 1px">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_nested_alternating"
|
||||
style="width: 100px; height: 100px; box-sizing: border-box; padding: 3px; border-width: 2px;">
|
||||
<div style="width: 40px; height: 40px; box-sizing: content-box; padding: 8px; border-width: 2px">
|
||||
<div style="width: 20px; height: 25px; box-sizing: border-box; padding: 3px; border-width: 6px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: content-box; padding: 1px; border-width: 1px">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="box_sizing_content_box_flex_basis_row"
|
||||
style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_flex_basis_row" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="box_sizing_content_box_flex_basis_column"
|
||||
style="width: 100px; height: 100px; flex-direction: column;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_flex_basis_column" style="width: 100px; height: 100px; flex-direction: column;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_start"
|
||||
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_start"
|
||||
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_end"
|
||||
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_end"
|
||||
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_start"
|
||||
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_start"
|
||||
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_end"
|
||||
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_end"
|
||||
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: border-box">
|
||||
</div>
|
@@ -29,3 +29,61 @@
|
||||
<div id="display_none_with_position_absolute" style="width: 100px; height: 100px;">
|
||||
<div style="display:none; position: absolute; width: 100px; height: 100px"></div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_fixed_size" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; width: 50px; height: 50px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_margin" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="width: 20px; height: 20px; display: contents; margin: 10px;"></div>
|
||||
<div style="flex-grow: 1;"></div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_padding" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; padding: 10px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_position" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; top: 10px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_position_absolute" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; position: absolute; width: 50px; height: 50px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_nested" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents;">
|
||||
<div style="display: contents;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_siblings" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="flex: 1; height: 30px;"></div>
|
||||
<div style="display: contents;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
<div style="flex: 1; height: 30px;"></div>
|
||||
</div>
|
568
gentest/fixtures/YGIntrinsicSizeTest.html
Normal file
568
gentest/fixtures/YGIntrinsicSizeTest.html
Normal file
@@ -0,0 +1,568 @@
|
||||
<div id="contains_inner_text_long_word" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;">
|
||||
LoremipsumdolorsitametconsecteturadipiscingelitSedeleifasdfettortoracauctorFuscerhoncusipsumtemporerosaliquamconsequatPraesentsoda
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_no_width_no_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_no_width_no_height_long_word_in_paragraph"
|
||||
style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus
|
||||
loremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumlorem
|
||||
Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_width" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;width:100px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_no_width_fixed_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_width_fixed_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;width: 50px; height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_max_width_max_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;max-width: 50px; max-height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_max_width_max_height_column" style="width:2000px; align-items: flex-start;">
|
||||
<div style="max-width: 50px;">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="contains_inner_text_max_width" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;max-width:100px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_width_shorter_text" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;width:100px">
|
||||
Lorem ipsum
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_height_shorter_text" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;height:100px">
|
||||
Lorem ipsum
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_max_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;max-height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="max_content_width" style="flex-direction: row; width:max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_width" style="width: 90px;">
|
||||
<div style="flex-direction: row; width: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="stretch_width" style="width: 500px;">
|
||||
<div style="flex-direction: row; width: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="max_content_height" style="height:max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_height" style="height: 90px; ">
|
||||
<div style="height: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_height" style="height: 500px;">
|
||||
<div style="height: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="max_content_flex_basis_column" style="flex-basis: max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_flex_basis_column" style="height: 90px;">
|
||||
<div style="flex-basis: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="stretch_flex_basis_column" style="height: 500px;">
|
||||
<div style="flex-basis: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_flex_basis_row" style="flex-direction: row; flex-basis: max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 500px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_flex_basis_row" style="width: 90px;">
|
||||
<div style="flex-direction: row; flex-basis: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_flex_basis_row" style="width: 500px;">
|
||||
<div style="flex-direction: row; flex-basis: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_max_width"
|
||||
style="flex-direction: row; max-width:max-content; width: 200px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_max_width" style="width: 90px;">
|
||||
<div style="flex-direction: row; max-width: fit-content; width: 110px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_max_width" style="width: 500px;">
|
||||
<div style="flex-direction: row; max-width: -webkit-fill-available; width: 600px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_min_width"
|
||||
style="flex-direction: row; min-width:max-content; width: 100px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_min_width" style="width: 90px;">
|
||||
<div style="flex-direction: row; min-width: fit-content; width: 90px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_min_width" style="width: 500px;">
|
||||
<div style="flex-direction: row; min-width: -webkit-fill-available; width: 400px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_max_height" style="max-height:max-content; height: 200px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_max_height" style="height: 90px;">
|
||||
<div style="max-height: fit-content; height: 110px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_max_height" style="height: 500px;">
|
||||
<div style="max-height: -webkit-fill-available; flex-wrap: wrap; height: 600px;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_min_height" style="min-height:max-content; height: 100px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_min_height" style="height: 90px;">
|
||||
<div style="min-height: fit-content; height: 90px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_min_height" style="height: 500px;">
|
||||
<div style="min-height: -webkit-fill-available; flex-wrap: wrap; height: 400px;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_max_content_width" style="width: 200px">
|
||||
<div style="width: max-content;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_stretch_width" style="width: 200px">
|
||||
<div style="width: -webkit-fill-available;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_fit_content_width" style="width: 200px">
|
||||
<div style="width: fit-content;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_max_content_min_width" style="width: 200px">
|
||||
<div style="min-width: max-content; width: 200px;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_stretch_min_width" style="width: 200px">
|
||||
<div style="min-width: -webkit-fill-available; width: 100px;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" data-disabled="true" id="text_fit_content_min_width" style="width: 200px">
|
||||
<div style="min-width: fit-content; width: 300px">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_max_content_max_width" style="width: 200px">
|
||||
<div style="max-width: max-content; width: 2000px;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_stretch_max_width" style="width: 200px">
|
||||
<div style="max-width: -webkit-fill-available; width: 300px;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="text_fit_content_max_width" style="width: 200px">
|
||||
<div style="max-width: fit-content; width: 1000px">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -157,13 +157,15 @@
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_reverse_space_around" style="width: 102px; height: 102px; flex-direction: row-reverse; justify-content: space-around;">
|
||||
<!-- TODO T208209388: fallback to start vs flexstart in overflowed cases -->
|
||||
<div data-disabled="true" id="justify_content_overflow_row_reverse_space_around" style="width: 102px; height: 102px; flex-direction: row-reverse; justify-content: space-around;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_reverse_space_evenly" style="width: 102px; height: 102px; flex-direction: row-reverse; justify-content: space-evenly;">
|
||||
<!-- TODO T208209388: fallback to start vs flexstart in overflowed cases -->
|
||||
<div data-disabled="true" id="justify_content_overflow_row_reverse_space_evenly" style="width: 102px; height: 102px; flex-direction: row-reverse; justify-content: space-evenly;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
|
@@ -693,3 +693,20 @@
|
||||
style="height: 50%; width: 50%; position: absolute; border-width: 3px 2px 1px 4px; padding: 7px 5px 4px 3px; margin: 11px 15px 1px 12px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="static_position_absolute_child_multiple">
|
||||
<div style="width: 400px; height: 400px; padding: 100px; position: relative">
|
||||
<div style="height:100px; width: 100px; position: static">
|
||||
<div style="height: 50px; width: 10%; position: absolute">
|
||||
</div>
|
||||
</div>
|
||||
<div style="height:100px; width: 100px; position: static">
|
||||
<div style="height: 50px; width: 50%; position: absolute">
|
||||
</div>
|
||||
<div style="height: 50px; width: 50%; position: absolute">
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 50px; width: 25px; position: absolute">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
BIN
gentest/fonts/Ahem.ttf
Normal file
BIN
gentest/fonts/Ahem.ttf
Normal file
Binary file not shown.
@@ -12,15 +12,44 @@ function toValueCpp(value) {
|
||||
return n + (Number(n) == n && n % 1 !== 0 ? 'f' : '');
|
||||
}
|
||||
|
||||
function toFunctionName(value) {
|
||||
function toFunctionNameCpp(value) {
|
||||
if (value.indexOf('%') >= 0) {
|
||||
return 'Percent';
|
||||
} else if (value.indexOf('Auto') >= 0) {
|
||||
return 'Auto';
|
||||
} else if (value.indexOf('MaxContent') >= 0) {
|
||||
return 'MaxContent';
|
||||
} else if (value.indexOf('FitContent') >= 0) {
|
||||
return 'FitContent';
|
||||
} else if (value.indexOf('Stretch') >= 0) {
|
||||
return 'Stretch';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function keywordFunctionCpp(functionPrefix, nodeName, value) {
|
||||
const functionSuffix = toFunctionNameCpp(value);
|
||||
if (
|
||||
functionSuffix == 'Auto' ||
|
||||
functionSuffix == 'MaxContent' ||
|
||||
functionSuffix == 'FitContent' ||
|
||||
functionSuffix == 'Stretch'
|
||||
) {
|
||||
return functionPrefix + functionSuffix + '(' + nodeName + ');';
|
||||
} else {
|
||||
return (
|
||||
functionPrefix +
|
||||
functionSuffix +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const CPPEmitter = function () {
|
||||
Emitter.call(this, 'cpp', ' ');
|
||||
};
|
||||
@@ -30,7 +59,12 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitPrologue: {
|
||||
value: function () {
|
||||
this.push(['#include <gtest/gtest.h>', '#include <yoga/Yoga.h>', '']);
|
||||
this.push([
|
||||
'#include <gtest/gtest.h>',
|
||||
'#include <yoga/Yoga.h>',
|
||||
'#include "../util/TestUtil.h"',
|
||||
'',
|
||||
]);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -44,7 +78,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push('');
|
||||
}
|
||||
|
||||
this.push('const YGConfigRef config = YGConfigNew();');
|
||||
this.push('YGConfigRef config = YGConfigNew();');
|
||||
for (const i in experiments) {
|
||||
this.push(
|
||||
'YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' +
|
||||
@@ -58,9 +92,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitTestTreePrologue: {
|
||||
value: function (nodeName) {
|
||||
this.push(
|
||||
'const YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);',
|
||||
);
|
||||
this.push('YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);');
|
||||
},
|
||||
},
|
||||
|
||||
@@ -133,12 +165,20 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
YGWrapWrap: {value: 'YGWrapWrap'},
|
||||
YGWrapWrapReverse: {value: 'YGWrapWrapReverse'},
|
||||
|
||||
YGBoxSizingBorderBox: {value: 'YGBoxSizingBorderBox'},
|
||||
YGBoxSizingContentBox: {value: 'YGBoxSizingContentBox'},
|
||||
|
||||
YGUndefined: {value: 'YGUndefined'},
|
||||
|
||||
YGDisplayFlex: {value: 'YGDisplayFlex'},
|
||||
YGDisplayNone: {value: 'YGDisplayNone'},
|
||||
YGDisplayContents: {value: 'YGDisplayContents'},
|
||||
YGAuto: {value: 'YGAuto'},
|
||||
|
||||
YGMaxContent: {value: 'MaxContent'},
|
||||
YGFitContent: {value: 'FitContent'},
|
||||
YGStretch: {value: 'Stretch'},
|
||||
|
||||
YGNodeCalculateLayout: {
|
||||
value: function (node, dir, _experiments) {
|
||||
this.push(
|
||||
@@ -225,7 +265,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetAspectRatio' +
|
||||
toFunctionName(value) +
|
||||
toFunctionNameCpp(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -267,15 +307,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetFlexBasis: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetFlexBasis' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetFlexBasis', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
@@ -319,20 +351,6 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetJustifyContent: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
@@ -355,7 +373,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
}
|
||||
this.push(
|
||||
'YGNodeStyleSetMargin' +
|
||||
toFunctionName(value) +
|
||||
toFunctionNameCpp(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -366,59 +384,39 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetMaxHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMaxHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetMaxWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMaxWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetMinHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetMinWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
@@ -434,7 +432,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
value: function (nodeName, edge, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetPadding' +
|
||||
toFunctionName(value) +
|
||||
toFunctionNameCpp(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -448,15 +446,20 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetPosition: {
|
||||
value: function (nodeName, edge, value) {
|
||||
let valueStr = toValueCpp(value);
|
||||
if (valueStr != 'YGAuto') {
|
||||
valueStr = ', ' + valueStr;
|
||||
} else {
|
||||
valueStr = '';
|
||||
}
|
||||
this.push(
|
||||
'YGNodeStyleSetPosition' +
|
||||
toFunctionName(value) +
|
||||
toFunctionNameCpp(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
edge +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
valueStr +
|
||||
');',
|
||||
);
|
||||
},
|
||||
@@ -474,25 +477,11 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetGap: {
|
||||
value: function (nodeName, gap, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetGap' +
|
||||
toFunctionName(value) +
|
||||
toFunctionNameCpp(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -503,4 +492,21 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBoxSizing: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetBoxSizing(' + nodeName + ', ' + toValueCpp(value) + ');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeSetMeasureFunc: {
|
||||
value: function (nodeName, innerText, _) {
|
||||
this.push(`YGNodeSetContext(${nodeName}, (void*)"${innerText}");`);
|
||||
this.push(
|
||||
`YGNodeSetMeasureFunc(${nodeName}, &facebook::yoga::test::IntrinsicSizeMeasure);`,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@@ -100,15 +100,21 @@ for (const fileName of fixtures) {
|
||||
await driver.get('file://' + process.cwd() + '/test.html');
|
||||
const logs = await driver.manage().logs().get(logging.Type.BROWSER);
|
||||
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/tests/generated/${fileNameNoExtension}.cpp`,
|
||||
addSignatureToSourceCode(JSON.parse(logs[0].message.replace(/^[^"]*/, ''))),
|
||||
const testLogs = logs.filter(
|
||||
log => !log.message.replace(/^[^"]*/, '').startsWith('"gentest-log:'),
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/java/tests/com/facebook/yoga/${fileNameNoExtension}.java`,
|
||||
`${yogaDir}/tests/generated/${fileNameNoExtension}.cpp`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(logs[1].message.replace(/^[^"]*/, '')).replace(
|
||||
JSON.parse(testLogs[0].message.replace(/^[^"]*/, '')),
|
||||
),
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/java/tests/generated/com/facebook/yoga/${fileNameNoExtension}.java`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(testLogs[1].message.replace(/^[^"]*/, '')).replace(
|
||||
'YogaTest',
|
||||
fileNameNoExtension,
|
||||
),
|
||||
@@ -118,7 +124,7 @@ for (const fileName of fixtures) {
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/javascript/tests/generated/${fileNameNoExtension}.test.ts`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(logs[2].message.replace(/^[^"]*/, '')).replace(
|
||||
JSON.parse(testLogs[2].message.replace(/^[^"]*/, '')).replace(
|
||||
'YogaTest',
|
||||
fileNameNoExtension,
|
||||
),
|
||||
|
@@ -17,10 +17,38 @@ function toMethodName(value) {
|
||||
return 'Percent';
|
||||
} else if (value.indexOf('AUTO') >= 0) {
|
||||
return 'Auto';
|
||||
} else if (value.indexOf('MAX_CONTENT') >= 0) {
|
||||
return 'MaxContent';
|
||||
} else if (value.indexOf('FIT_CONTENT') >= 0) {
|
||||
return 'FitContent';
|
||||
} else if (value.indexOf('STRETCH') >= 0) {
|
||||
return 'Stretch';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function keywordMethod(methodPrefix, nodeName, value) {
|
||||
const methodSuffix = toMethodName(value);
|
||||
if (
|
||||
methodSuffix == 'Auto' ||
|
||||
methodSuffix == 'MaxContent' ||
|
||||
methodSuffix == 'FitContent' ||
|
||||
methodSuffix == 'Stretch'
|
||||
) {
|
||||
return nodeName + '.' + methodPrefix + methodSuffix + '();';
|
||||
} else {
|
||||
return (
|
||||
nodeName +
|
||||
'.' +
|
||||
methodPrefix +
|
||||
methodSuffix +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const JavaEmitter = function () {
|
||||
Emitter.call(this, 'java', ' ');
|
||||
};
|
||||
@@ -55,6 +83,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
'import org.junit.Test;',
|
||||
'import org.junit.runner.RunWith;',
|
||||
'import org.junit.runners.Parameterized;',
|
||||
'import com.facebook.yoga.utils.TestUtils;',
|
||||
'',
|
||||
'@RunWith(Parameterized.class)',
|
||||
'public class YogaTest {',
|
||||
@@ -177,12 +206,20 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGDisplayFlex: {value: 'YogaDisplay.FLEX'},
|
||||
YGDisplayNone: {value: 'YogaDisplay.NONE'},
|
||||
YGDisplayContents: {value: 'YogaDisplay.CONTENTS'},
|
||||
YGAuto: {value: 'YogaConstants.AUTO'},
|
||||
|
||||
YGWrapNoWrap: {value: 'YogaWrap.NO_WRAP'},
|
||||
YGWrapWrap: {value: 'YogaWrap.WRAP'},
|
||||
YGWrapWrapReverse: {value: 'YogaWrap.WRAP_REVERSE'},
|
||||
|
||||
YGBoxSizingBorderBox: {value: 'YogaBoxSizing.BORDER_BOX'},
|
||||
YGBoxSizingContentBox: {value: 'YogaBoxSizing.CONTENT_BOX'},
|
||||
|
||||
YGMaxContent: {value: 'MAX_CONTENT'},
|
||||
YGFitContent: {value: 'FIT_CONTENT'},
|
||||
YGStretch: {value: 'STRETCH'},
|
||||
|
||||
YGNodeCalculateLayout: {
|
||||
value: function (node, dir, _experiments) {
|
||||
this.push(node + '.setDirection(' + dir + ');');
|
||||
@@ -269,14 +306,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetFlexBasis: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setFlexBasis' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
this.push(keywordMethod('setFlexBasis', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
@@ -304,19 +334,6 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetJustifyContent: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(nodeName + '.setJustifyContent(' + toValueJava(value) + ');');
|
||||
@@ -344,55 +361,39 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMaxHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
this.push(keywordMethod('setMaxHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMaxWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
this.push(keywordMethod('setMaxWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMinHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
this.push(keywordMethod('setMinHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMinWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
this.push(keywordMethod('setMinWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
@@ -419,15 +420,21 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetPosition: {
|
||||
value: function (nodeName, edge, value) {
|
||||
let valueStr = toValueJava(value);
|
||||
|
||||
if (valueStr == 'YogaConstants.AUTO') {
|
||||
valueStr = '';
|
||||
} else {
|
||||
valueStr = ', ' + valueStr + 'f';
|
||||
}
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setPosition' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
edge +
|
||||
', ' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
valueStr +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -438,19 +445,6 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetGap: {
|
||||
value: function (nodeName, gap, value) {
|
||||
this.push(
|
||||
@@ -465,4 +459,19 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBoxSizing: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(nodeName + '.setBoxSizing(' + toValueJava(value) + ');');
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeSetMeasureFunc: {
|
||||
value: function (nodeName, innerText, _) {
|
||||
this.push(`${nodeName}.setData("${innerText}");`);
|
||||
this.push(
|
||||
`${nodeName}.setMeasureFunction(new TestUtils.intrinsicMeasureFunction());`,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@@ -15,6 +15,9 @@ function toValueJavascript(value) {
|
||||
if (value.match(/^[0-9.e+-]+px$/i)) return parseFloat(value);
|
||||
if (value.match(/^[0-9.e+-]+%/i)) return JSON.stringify(value);
|
||||
if (value == 'Yoga.AUTO') return '"auto"';
|
||||
if (value == 'max-content') return '"max-content"';
|
||||
if (value == 'fit-content') return '"fit-content"';
|
||||
if (value == 'stretch') return '"stretch"';
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -23,10 +26,14 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitPrologue: {
|
||||
value: function () {
|
||||
this.push(
|
||||
"import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'",
|
||||
);
|
||||
this.push("import Yoga from 'yoga-layout';");
|
||||
this.push('import {');
|
||||
this.pushIndent();
|
||||
this.push('Align,');
|
||||
this.push('BoxSizing,');
|
||||
this.push('Direction,');
|
||||
this.push('Display,');
|
||||
this.push('Edge,');
|
||||
@@ -167,6 +174,14 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGDisplayFlex: {value: 'Display.Flex'},
|
||||
YGDisplayNone: {value: 'Display.None'},
|
||||
YGDisplayContents: {value: 'Display.Contents'},
|
||||
|
||||
YGBoxSizingBorderBox: {value: 'BoxSizing.BorderBox'},
|
||||
YGBoxSizingContentBox: {value: 'BoxSizing.ContentBox'},
|
||||
|
||||
YGMaxContent: {value: 'max-content'},
|
||||
YGFitContent: {value: 'fit-content'},
|
||||
YGStretch: {value: 'stretch'},
|
||||
|
||||
YGNodeCalculateLayout: {
|
||||
value: function (node, dir, _experiments) {
|
||||
@@ -361,14 +376,22 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetPosition: {
|
||||
value: function (nodeName, edge, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setPosition(' +
|
||||
toValueJavascript(edge) +
|
||||
', ' +
|
||||
toValueJavascript(value) +
|
||||
');',
|
||||
);
|
||||
const valueStr = toValueJavascript(value);
|
||||
|
||||
if (valueStr == "'auto'") {
|
||||
this.push(
|
||||
nodeName + '.setPositionAuto(' + toValueJavascript(edge) + ');',
|
||||
);
|
||||
} else {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setPosition(' +
|
||||
toValueJavascript(edge) +
|
||||
', ' +
|
||||
valueStr +
|
||||
');',
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -398,4 +421,20 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBoxSizing: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(nodeName + '.setBoxSizing(' + toValueJavascript(value) + ');');
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeSetMeasureFunc: {
|
||||
value: function (nodeName, innerText, flexDirection) {
|
||||
this.push(
|
||||
`${nodeName}.setMeasureFunc(instrinsicSizeMeasureFunc.bind({text: "${innerText}", flexDirection: ${toValueJavascript(
|
||||
flexDirection,
|
||||
)}}));`,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
11
gentest/gentest-log.js
Normal file
11
gentest/gentest-log.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function gentestLog(message) {
|
||||
console.log('gentest-log: ', message);
|
||||
}
|
@@ -11,30 +11,33 @@ import * as fs from 'node:fs/promises';
|
||||
import {dirname} from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
import signedsource from 'signedsource';
|
||||
import {glob} from 'glob';
|
||||
|
||||
const yogaDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
const cppTestDir = `${yogaDir}/tests/generated`;
|
||||
const jsTestDir = `${yogaDir}/javascript/tests/generated`;
|
||||
const javaTestDir = `${yogaDir}/java/tests/com/facebook/yoga`;
|
||||
const testDirs = [cppTestDir, jsTestDir, javaTestDir];
|
||||
const yogaRootDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
|
||||
for (const testDir of testDirs) {
|
||||
const tests = await fs.readdir(testDir);
|
||||
const filesToValidate = await glob(
|
||||
[
|
||||
'tests/generated/**/*.{h,cpp}',
|
||||
'javascript/tests/generated/**/*.test.ts',
|
||||
'java/tests/generated/com/facebook/yoga/**/*.java',
|
||||
],
|
||||
{
|
||||
cwd: yogaRootDir,
|
||||
},
|
||||
);
|
||||
|
||||
for (const test of tests) {
|
||||
const testData = await fs.readFile(`${testDir}/${test}`, 'utf8');
|
||||
try {
|
||||
const validSignature = signedsource.verifySignature(testData);
|
||||
if (!validSignature) {
|
||||
console.error(`Invalid signature for ${test}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
} catch (e) {
|
||||
// Java test dir does not separate generated tests from non-generated ones
|
||||
if (testDir != javaTestDir) {
|
||||
console.error(`${test}: ${e}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
console.log(`Found ${filesToValidate.length} files to validate`);
|
||||
|
||||
for (const file of filesToValidate) {
|
||||
const content = await fs.readFile(`${yogaRootDir}/${file}`, 'utf8');
|
||||
if (signedsource.isSigned(content)) {
|
||||
console.log(`Checking ${file}`);
|
||||
const validSignature = signedsource.verifySignature(content);
|
||||
if (!validSignature) {
|
||||
console.error(`Invalid signature "${file}"`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
} else {
|
||||
console.log(`Skipped ${file}`);
|
||||
}
|
||||
}
|
||||
|
@@ -175,6 +175,7 @@ function checkDefaultValues() {
|
||||
{style: 'right', value: 'undefined'},
|
||||
{style: 'bottom', value: 'undefined'},
|
||||
{style: 'display', value: 'flex'},
|
||||
{style: 'box-sizing', value: 'border-box'},
|
||||
].forEach(item => {
|
||||
assert(
|
||||
isDefaultStyleValue(item.style, item.value),
|
||||
@@ -193,7 +194,6 @@ function setupTestTree(
|
||||
index,
|
||||
) {
|
||||
e.emitTestTreePrologue(nodeName);
|
||||
|
||||
for (const style in node.style) {
|
||||
// Skip position info for root as it messes up tests
|
||||
if (
|
||||
@@ -207,7 +207,6 @@ function setupTestTree(
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isDefaultStyleValue(style, node.style[style])) {
|
||||
switch (style) {
|
||||
case 'aspect-ratio':
|
||||
@@ -520,6 +519,11 @@ function setupTestTree(
|
||||
case 'display':
|
||||
e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style]));
|
||||
break;
|
||||
case 'box-sizing':
|
||||
e.YGNodeStyleSetBoxSizing(
|
||||
nodeName,
|
||||
boxSizingValue(e, node.style[style]),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,6 +532,14 @@ function setupTestTree(
|
||||
e.YGNodeInsertChild(parentName, nodeName, index);
|
||||
}
|
||||
|
||||
if (node.innerText && node.children.length === 0) {
|
||||
e.YGNodeSetMeasureFunc(
|
||||
nodeName,
|
||||
node.innerText,
|
||||
flexDirectionValue(e, node.style['flex-direction']),
|
||||
);
|
||||
}
|
||||
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
e.push('');
|
||||
const childName = nodeName + '_child' + i;
|
||||
@@ -646,6 +658,13 @@ function pointValue(e, value) {
|
||||
return e.YGAuto;
|
||||
case 'undefined':
|
||||
return e.YGUndefined;
|
||||
case 'max-content':
|
||||
return e.YGMaxContent;
|
||||
case 'fit-content':
|
||||
return e.YGFitContent;
|
||||
case 'stretch':
|
||||
case '-webkit-fill-available':
|
||||
return e.YGStretch;
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
@@ -657,6 +676,17 @@ function displayValue(e, value) {
|
||||
return e.YGDisplayFlex;
|
||||
case 'none':
|
||||
return e.YGDisplayNone;
|
||||
case 'contents':
|
||||
return e.YGDisplayContents;
|
||||
}
|
||||
}
|
||||
|
||||
function boxSizingValue(e, value) {
|
||||
switch (value) {
|
||||
case 'border-box':
|
||||
return e.YGBoxSizingBorderBox;
|
||||
case 'content-box':
|
||||
return e.YGBoxSizingContentBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,6 +753,7 @@ function calculateTree(root, parentOffsetLeft, parentOffsetTop) {
|
||||
? child.dataset.experiments.split(' ')
|
||||
: [],
|
||||
disabled: child.dataset.disabled === 'true',
|
||||
innerText: child.innerText,
|
||||
};
|
||||
|
||||
const size = getRoundedSize(child);
|
||||
@@ -777,6 +808,7 @@ function getYogaStyle(node) {
|
||||
'row-gap',
|
||||
'display',
|
||||
'aspect-ratio',
|
||||
'box-sizing',
|
||||
].reduce((map, key) => {
|
||||
map[key] =
|
||||
node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
|
||||
|
@@ -3,8 +3,8 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"gentest": "node --loader=babel-register-esm ./gentest-driver.ts",
|
||||
"gentest-validate": "node --loader=babel-register-esm ./gentest-validate.ts"
|
||||
"gentest": "node --disable-warning=ExperimentalWarning --loader=babel-register-esm ./gentest-driver.ts",
|
||||
"gentest-validate": "node --disable-warning=ExperimentalWarning --loader=babel-register-esm ./gentest-validate.ts"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
@@ -19,6 +19,7 @@
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^20.10.3",
|
||||
"@types/selenium-webdriver": "^4.1.21",
|
||||
"babel-register-esm": "^1.2.5"
|
||||
"babel-register-esm": "^1.2.5",
|
||||
"glob": "^10.4.2"
|
||||
}
|
||||
}
|
||||
|
@@ -1,70 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>%s</title>
|
||||
<script src="gentest.js"></script>
|
||||
<script src="gentest-cpp.js"></script>
|
||||
<script src="gentest-java.js"></script>
|
||||
<script src="gentest-javascript.js"></script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: Helvetica;
|
||||
font-size: 14px;
|
||||
font-weight: 100;
|
||||
}
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>%s</title>
|
||||
<script src="gentest.js"></script>
|
||||
<script src="gentest-cpp.js"></script>
|
||||
<script src="gentest-java.js"></script>
|
||||
<script src="gentest-javascript.js"></script>
|
||||
<script src="gentest-log.js"></script>
|
||||
|
||||
div, span {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border: 0 solid black;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-start;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Ahem';
|
||||
src: url('./fonts/Ahem.ttf') format('truetype');
|
||||
}
|
||||
|
||||
body > * {
|
||||
position: absolute;
|
||||
}
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font: 10px/1 Ahem;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
#ltr-container > * {
|
||||
position: absolute;
|
||||
direction: ltr;
|
||||
}
|
||||
div,
|
||||
span {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border: 0 solid black;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-start;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
#rtl-container > * {
|
||||
position: absolute;
|
||||
direction: rtl;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
body>* {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
<body>
|
||||
<div id='ltr-container'>
|
||||
#ltr-container>* {
|
||||
position: absolute;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
%s
|
||||
#rtl-container>* {
|
||||
position: absolute;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
<div id='rtl-container'>
|
||||
</style>
|
||||
</head>
|
||||
|
||||
%s
|
||||
<body>
|
||||
<div id='ltr-container'>
|
||||
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
%s
|
||||
|
||||
<div>
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
<div id='rtl-container'>
|
||||
|
||||
%s
|
||||
%s
|
||||
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
%s
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=3.1.0
|
||||
VERSION_NAME=0.0.0
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
26
gradlew
vendored
26
gradlew
vendored
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -83,7 +85,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -130,10 +133,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -141,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -149,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -198,11 +204,11 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
22
gradlew.bat
vendored
22
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
@@ -1,4 +1,17 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.facebook.yoga"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
>
|
||||
|
||||
<application/>
|
||||
|
||||
|
@@ -21,15 +21,16 @@ val ndkVersionProperty: String by rootProject.extra
|
||||
|
||||
android {
|
||||
namespace = "com.facebook.yoga"
|
||||
compileSdk = 34
|
||||
buildToolsVersion = "34.0.0"
|
||||
ndkVersion = "26.0.10792818"
|
||||
compileSdk = 35
|
||||
buildToolsVersion = "35.0.0"
|
||||
ndkVersion = "27.1.12297006"
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 21
|
||||
consumerProguardFiles("proguard-rules.pro")
|
||||
|
||||
ndk { abiFilters.addAll(setOf("x86", "x86_64", "armeabi-v7a", "arm64-v8a")) }
|
||||
externalNativeBuild { cmake { arguments("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON") } }
|
||||
}
|
||||
|
||||
externalNativeBuild { cmake { path("CMakeLists.txt") } }
|
||||
|
33
java/com/facebook/yoga/YogaBoxSizing.java
Normal file
33
java/com/facebook/yoga/YogaBoxSizing.java
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public enum YogaBoxSizing {
|
||||
BORDER_BOX(0),
|
||||
CONTENT_BOX(1);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
YogaBoxSizing(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static YogaBoxSizing fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return BORDER_BOX;
|
||||
case 1: return CONTENT_BOX;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,7 +11,8 @@ package com.facebook.yoga;
|
||||
|
||||
public enum YogaDisplay {
|
||||
FLEX(0),
|
||||
NONE(1);
|
||||
NONE(1),
|
||||
CONTENTS(2);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -27,6 +28,7 @@ public enum YogaDisplay {
|
||||
switch (value) {
|
||||
case 0: return FLEX;
|
||||
case 1: return NONE;
|
||||
case 2: return CONTENTS;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ package com.facebook.yoga;
|
||||
public enum YogaErrata {
|
||||
NONE(0),
|
||||
STRETCH_FLEX_BASIS(1),
|
||||
ABSOLUTE_POSITIONING_INCORRECT(2),
|
||||
ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2),
|
||||
ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4),
|
||||
ALL(2147483647),
|
||||
CLASSIC(2147483646);
|
||||
@@ -31,7 +31,7 @@ public enum YogaErrata {
|
||||
switch (value) {
|
||||
case 0: return NONE;
|
||||
case 1: return STRETCH_FLEX_BASIS;
|
||||
case 2: return ABSOLUTE_POSITIONING_INCORRECT;
|
||||
case 2: return ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING;
|
||||
case 4: return ABSOLUTE_PERCENT_AGAINST_INNER_SIZE;
|
||||
case 2147483647: return ALL;
|
||||
case 2147483646: return CLASSIC;
|
||||
|
@@ -56,6 +56,8 @@ public class YogaNative {
|
||||
static native void jni_YGNodeStyleSetAlignContentJNI(long nativePointer, int alignContent);
|
||||
static native int jni_YGNodeStyleGetPositionTypeJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetPositionTypeJNI(long nativePointer, int positionType);
|
||||
static native int jni_YGNodeStyleGetBoxSizingJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetBoxSizingJNI(long nativePointer, int boxSizing);
|
||||
static native int jni_YGNodeStyleGetFlexWrapJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexWrapJNI(long nativePointer, int wrapType);
|
||||
static native int jni_YGNodeStyleGetOverflowJNI(long nativePointer);
|
||||
@@ -72,6 +74,9 @@ public class YogaNative {
|
||||
static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis);
|
||||
static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin);
|
||||
static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent);
|
||||
@@ -84,29 +89,48 @@ public class YogaNative {
|
||||
static native long jni_YGNodeStyleGetPositionJNI(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetPositionJNI(long nativePointer, int edge, float position);
|
||||
static native void jni_YGNodeStyleSetPositionPercentJNI(long nativePointer, int edge, float percent);
|
||||
static native void jni_YGNodeStyleSetPositionAutoJNI(long nativePointer, int edge);
|
||||
static native long jni_YGNodeStyleGetWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width);
|
||||
static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height);
|
||||
static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth);
|
||||
static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight);
|
||||
static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth);
|
||||
static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight);
|
||||
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer);
|
||||
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
|
||||
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
|
||||
static native long jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
|
||||
static native void jni_YGNodeStyleSetGapJNI(long nativePointer, int gutter, float gapLength);
|
||||
static native void jni_YGNodeStyleSetGapPercentJNI(long nativePointer, int gutter, float gapLength);
|
||||
static native void jni_YGNodeSetHasMeasureFuncJNI(long nativePointer, boolean hasMeasureFunc);
|
||||
|
@@ -88,6 +88,10 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setPositionType(YogaPositionType positionType);
|
||||
|
||||
public abstract YogaBoxSizing getBoxSizing();
|
||||
|
||||
public abstract void setBoxSizing(YogaBoxSizing boxSizing);
|
||||
|
||||
public abstract YogaWrap getWrap();
|
||||
|
||||
public abstract void setWrap(YogaWrap flexWrap);
|
||||
@@ -120,6 +124,12 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setFlexBasisAuto();
|
||||
|
||||
public abstract void setFlexBasisMaxContent();
|
||||
|
||||
public abstract void setFlexBasisFitContent();
|
||||
|
||||
public abstract void setFlexBasisStretch();
|
||||
|
||||
public abstract YogaValue getMargin(YogaEdge edge);
|
||||
|
||||
public abstract void setMargin(YogaEdge edge, float margin);
|
||||
@@ -144,6 +154,8 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setPositionPercent(YogaEdge edge, float percent);
|
||||
|
||||
public abstract void setPositionAuto(YogaEdge edge);
|
||||
|
||||
public abstract YogaValue getWidth();
|
||||
|
||||
public abstract void setWidth(float width);
|
||||
@@ -152,6 +164,12 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setWidthAuto();
|
||||
|
||||
public abstract void setWidthMaxContent();
|
||||
|
||||
public abstract void setWidthFitContent();
|
||||
|
||||
public abstract void setWidthStretch();
|
||||
|
||||
public abstract YogaValue getHeight();
|
||||
|
||||
public abstract void setHeight(float height);
|
||||
@@ -160,35 +178,65 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setHeightAuto();
|
||||
|
||||
public abstract void setHeightMaxContent();
|
||||
|
||||
public abstract void setHeightFitContent();
|
||||
|
||||
public abstract void setHeightStretch();
|
||||
|
||||
public abstract YogaValue getMinWidth();
|
||||
|
||||
public abstract void setMinWidth(float minWidth);
|
||||
|
||||
public abstract void setMinWidthPercent(float percent);
|
||||
|
||||
public abstract void setMinWidthMaxContent();
|
||||
|
||||
public abstract void setMinWidthFitContent();
|
||||
|
||||
public abstract void setMinWidthStretch();
|
||||
|
||||
public abstract YogaValue getMinHeight();
|
||||
|
||||
public abstract void setMinHeight(float minHeight);
|
||||
|
||||
public abstract void setMinHeightPercent(float percent);
|
||||
|
||||
public abstract void setMinHeightMaxContent();
|
||||
|
||||
public abstract void setMinHeightFitContent();
|
||||
|
||||
public abstract void setMinHeightStretch();
|
||||
|
||||
public abstract YogaValue getMaxWidth();
|
||||
|
||||
public abstract void setMaxWidth(float maxWidth);
|
||||
|
||||
public abstract void setMaxWidthPercent(float percent);
|
||||
|
||||
public abstract void setMaxWidthMaxContent();
|
||||
|
||||
public abstract void setMaxWidthFitContent();
|
||||
|
||||
public abstract void setMaxWidthStretch();
|
||||
|
||||
public abstract YogaValue getMaxHeight();
|
||||
|
||||
public abstract void setMaxHeight(float maxheight);
|
||||
|
||||
public abstract void setMaxHeightPercent(float percent);
|
||||
|
||||
public abstract void setMaxHeightMaxContent();
|
||||
|
||||
public abstract void setMaxHeightFitContent();
|
||||
|
||||
public abstract void setMaxHeightStretch();
|
||||
|
||||
public abstract float getAspectRatio();
|
||||
|
||||
public abstract void setAspectRatio(float aspectRatio);
|
||||
|
||||
public abstract float getGap(YogaGutter gutter);
|
||||
public abstract YogaValue getGap(YogaGutter gutter);
|
||||
|
||||
public abstract void setGap(YogaGutter gutter, float gapLength);
|
||||
|
||||
|
@@ -32,6 +32,7 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
private static final byte LAYOUT_BORDER_START_INDEX = 14;
|
||||
|
||||
@Nullable private YogaNodeJNIBase mOwner;
|
||||
@Nullable private YogaConfig mConfig;
|
||||
@Nullable private List<YogaNodeJNIBase> mChildren;
|
||||
@Nullable private YogaMeasureFunction mMeasureFunction;
|
||||
@Nullable private YogaBaselineFunction mBaselineFunction;
|
||||
@@ -57,6 +58,7 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
|
||||
YogaNodeJNIBase(YogaConfig config) {
|
||||
this(YogaNative.jni_YGNodeNewWithConfigJNI(((YogaConfigJNIBase) config).mNativePointer));
|
||||
mConfig = config; // makes sure the YogaConfig is not garbage collected
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -299,6 +301,14 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetPositionTypeJNI(mNativePointer, positionType.intValue());
|
||||
}
|
||||
|
||||
public YogaBoxSizing getBoxSizing() {
|
||||
return YogaBoxSizing.fromInt(YogaNative.jni_YGNodeStyleGetBoxSizingJNI(mNativePointer));
|
||||
}
|
||||
|
||||
public void setBoxSizing(YogaBoxSizing boxSizing) {
|
||||
YogaNative.jni_YGNodeStyleSetBoxSizingJNI(mNativePointer, boxSizing.intValue());
|
||||
}
|
||||
|
||||
public YogaWrap getWrap() {
|
||||
return YogaWrap.fromInt(YogaNative.jni_YGNodeStyleGetFlexWrapJNI(mNativePointer));
|
||||
}
|
||||
@@ -363,6 +373,18 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMargin(YogaEdge edge) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()));
|
||||
}
|
||||
@@ -411,6 +433,10 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetPositionPercentJNI(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
public void setPositionAuto(YogaEdge edge) {
|
||||
YogaNative.jni_YGNodeStyleSetPositionAutoJNI(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
public YogaValue getWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -427,6 +453,18 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -443,6 +481,18 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMinWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -455,6 +505,18 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMinWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMinHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -467,6 +529,18 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMinHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMaxWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -479,6 +553,18 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMaxWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMaxHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -491,6 +577,18 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMaxHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public float getAspectRatio() {
|
||||
return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer);
|
||||
}
|
||||
@@ -713,8 +811,8 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGap(YogaGutter gutter) {
|
||||
return YogaNative.jni_YGNodeStyleGetGapJNI(mNativePointer, gutter.intValue());
|
||||
public YogaValue getGap(YogaGutter gutter) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetGapJNI(mNativePointer, gutter.intValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -15,15 +15,33 @@ public interface YogaProps {
|
||||
|
||||
void setWidthPercent(float percent);
|
||||
|
||||
void setWidthAuto();
|
||||
|
||||
void setWidthMaxContent();
|
||||
|
||||
void setWidthFitContent();
|
||||
|
||||
void setWidthStretch();
|
||||
|
||||
void setMinWidth(float minWidth);
|
||||
|
||||
void setMinWidthPercent(float percent);
|
||||
|
||||
void setMinWidthMaxContent();
|
||||
|
||||
void setMinWidthFitContent();
|
||||
|
||||
void setMinWidthStretch();
|
||||
|
||||
void setMaxWidth(float maxWidth);
|
||||
|
||||
void setMaxWidthPercent(float percent);
|
||||
|
||||
void setWidthAuto();
|
||||
void setMaxWidthMaxContent();
|
||||
|
||||
void setMaxWidthFitContent();
|
||||
|
||||
void setMaxWidthStretch();
|
||||
|
||||
/* Height properties */
|
||||
|
||||
@@ -31,15 +49,33 @@ public interface YogaProps {
|
||||
|
||||
void setHeightPercent(float percent);
|
||||
|
||||
void setHeightAuto();
|
||||
|
||||
void setHeightMaxContent();
|
||||
|
||||
void setHeightFitContent();
|
||||
|
||||
void setHeightStretch();
|
||||
|
||||
void setMinHeight(float minHeight);
|
||||
|
||||
void setMinHeightPercent(float percent);
|
||||
|
||||
void setMinHeightMaxContent();
|
||||
|
||||
void setMinHeightFitContent();
|
||||
|
||||
void setMinHeightStretch();
|
||||
|
||||
void setMaxHeight(float maxHeight);
|
||||
|
||||
void setMaxHeightPercent(float percent);
|
||||
|
||||
void setHeightAuto();
|
||||
void setMaxHeightMaxContent();
|
||||
|
||||
void setMaxHeightFitContent();
|
||||
|
||||
void setMaxHeightStretch();
|
||||
|
||||
/* Margin properties */
|
||||
|
||||
@@ -81,6 +117,12 @@ public interface YogaProps {
|
||||
|
||||
void setFlexBasis(float flexBasis);
|
||||
|
||||
void setFlexBasisMaxContent();
|
||||
|
||||
void setFlexBasisFitContent();
|
||||
|
||||
void setFlexBasisStretch();
|
||||
|
||||
void setFlexDirection(YogaFlexDirection direction);
|
||||
|
||||
void setFlexGrow(float flexGrow);
|
||||
@@ -105,6 +147,8 @@ public interface YogaProps {
|
||||
|
||||
void setBaselineFunction(YogaBaselineFunction yogaBaselineFunction);
|
||||
|
||||
void setBoxSizing(YogaBoxSizing boxSizing);
|
||||
|
||||
/* Getters */
|
||||
|
||||
YogaValue getWidth();
|
||||
@@ -148,4 +192,6 @@ public interface YogaProps {
|
||||
YogaValue getPosition(YogaEdge edge);
|
||||
|
||||
float getBorder(YogaEdge edge);
|
||||
|
||||
YogaBoxSizing getBoxSizing();
|
||||
}
|
||||
|
@@ -13,7 +13,10 @@ public enum YogaUnit {
|
||||
UNDEFINED(0),
|
||||
POINT(1),
|
||||
PERCENT(2),
|
||||
AUTO(3);
|
||||
AUTO(3),
|
||||
MAX_CONTENT(4),
|
||||
FIT_CONTENT(5),
|
||||
STRETCH(6);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -31,6 +34,9 @@ public enum YogaUnit {
|
||||
case 1: return POINT;
|
||||
case 2: return PERCENT;
|
||||
case 3: return AUTO;
|
||||
case 4: return MAX_CONTENT;
|
||||
case 5: return FIT_CONTENT;
|
||||
case 6: return STRETCH;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
@@ -429,6 +429,28 @@ static void jni_YGNodeCopyStyleJNI(
|
||||
YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) \
|
||||
static void jni_YGNodeStyleSet##name##MaxContentJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##MaxContent(_jlong2YGNodeRef(nativePointer)); \
|
||||
} \
|
||||
static void jni_YGNodeStyleSet##name##FitContentJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##FitContent(_jlong2YGNodeRef(nativePointer)); \
|
||||
} \
|
||||
static void jni_YGNodeStyleSet##name##StretchJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##Stretch(_jlong2YGNodeRef(nativePointer)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||
static jlong jni_YGNodeStyleGet##name##JNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \
|
||||
@@ -460,6 +482,14 @@ static void jni_YGNodeCopyStyleJNI(
|
||||
static_cast<float>(value)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(name) \
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||
static void jni_YGNodeStyleSet##name##AutoJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \
|
||||
YGNodeStyleSet##name##Auto( \
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<YGEdge>(edge)); \
|
||||
}
|
||||
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGFlexDirection, FlexDirection);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGJustify, JustifyContent);
|
||||
@@ -467,6 +497,7 @@ YG_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignItems);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignSelf);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignContent);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGPositionType, PositionType);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGBoxSizing, BoxSizing);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGDisplay, Display);
|
||||
@@ -474,15 +505,15 @@ YG_NODE_JNI_STYLE_PROP(jfloat, float, Flex);
|
||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
|
||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
|
||||
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(FlexBasis);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Width);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MinWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MaxWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Height);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MinHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(FlexBasis);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Width);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Height);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxHeight);
|
||||
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(Position);
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(Position);
|
||||
|
||||
static jlong jni_YGNodeStyleGetMarginJNI(
|
||||
JNIEnv* /*env*/,
|
||||
@@ -694,13 +725,13 @@ jni_YGNodeCloneJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) {
|
||||
return reinterpret_cast<jlong>(clonedYogaNode);
|
||||
}
|
||||
|
||||
static jfloat jni_YGNodeStyleGetGapJNI(
|
||||
static jlong jni_YGNodeStyleGetGapJNI(
|
||||
JNIEnv* /*env*/,
|
||||
jobject /*obj*/,
|
||||
jlong nativePointer,
|
||||
jint gutter) {
|
||||
return (jfloat)YGNodeStyleGetGap(
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<YGGutter>(gutter));
|
||||
return YogaValue::asJavaLong(YGNodeStyleGetGap(
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<YGGutter>(gutter)));
|
||||
}
|
||||
|
||||
static void jni_YGNodeStyleSetGapJNI(
|
||||
@@ -811,6 +842,12 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetPositionTypeJNI",
|
||||
"(JI)V",
|
||||
(void*)jni_YGNodeStyleSetPositionTypeJNI},
|
||||
{"jni_YGNodeStyleGetBoxSizingJNI",
|
||||
"(J)I",
|
||||
(void*)jni_YGNodeStyleGetBoxSizingJNI},
|
||||
{"jni_YGNodeStyleSetBoxSizingJNI",
|
||||
"(JI)V",
|
||||
(void*)jni_YGNodeStyleSetBoxSizingJNI},
|
||||
{"jni_YGNodeStyleGetFlexWrapJNI",
|
||||
"(J)I",
|
||||
(void*)jni_YGNodeStyleGetFlexWrapJNI},
|
||||
@@ -855,6 +892,15 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetFlexBasisAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisAutoJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisFitContentJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisStretchJNI},
|
||||
{"jni_YGNodeStyleGetMarginJNI",
|
||||
"(JI)J",
|
||||
(void*)jni_YGNodeStyleGetMarginJNI},
|
||||
@@ -891,6 +937,9 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetPositionPercentJNI",
|
||||
"(JIF)V",
|
||||
(void*)jni_YGNodeStyleSetPositionPercentJNI},
|
||||
{"jni_YGNodeStyleSetPositionAutoJNI",
|
||||
"(JI)V",
|
||||
(void*)jni_YGNodeStyleSetPositionAutoJNI},
|
||||
{"jni_YGNodeStyleGetWidthJNI", "(J)J", (void*)jni_YGNodeStyleGetWidthJNI},
|
||||
{"jni_YGNodeStyleSetWidthJNI", "(JF)V", (void*)jni_YGNodeStyleSetWidthJNI},
|
||||
{"jni_YGNodeStyleSetWidthPercentJNI",
|
||||
@@ -899,6 +948,15 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetWidthAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthAutoJNI},
|
||||
{"jni_YGNodeStyleSetWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetHeightJNI},
|
||||
{"jni_YGNodeStyleSetHeightJNI",
|
||||
"(JF)V",
|
||||
@@ -909,6 +967,15 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetHeightAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightAutoJNI},
|
||||
{"jni_YGNodeStyleSetHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetMinWidthJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMinWidthJNI},
|
||||
@@ -918,6 +985,15 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMinWidthPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthPercentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetMinHeightJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMinHeightJNI},
|
||||
@@ -927,6 +1003,15 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMinHeightPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightPercentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetMaxWidthJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMaxWidthJNI},
|
||||
@@ -936,6 +1021,15 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMaxWidthPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthPercentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetMaxHeightJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMaxHeightJNI},
|
||||
@@ -945,6 +1039,15 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMaxHeightPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightPercentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetAspectRatioJNI",
|
||||
"(J)F",
|
||||
(void*)jni_YGNodeStyleGetAspectRatioJNI},
|
||||
@@ -954,7 +1057,7 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeSetHasMeasureFuncJNI",
|
||||
"(JZ)V",
|
||||
(void*)jni_YGNodeSetHasMeasureFuncJNI},
|
||||
{"jni_YGNodeStyleGetGapJNI", "(JI)F", (void*)jni_YGNodeStyleGetGapJNI},
|
||||
{"jni_YGNodeStyleGetGapJNI", "(JI)J", (void*)jni_YGNodeStyleGetGapJNI},
|
||||
{"jni_YGNodeStyleSetGapJNI", "(JIF)V", (void*)jni_YGNodeStyleSetGapJNI},
|
||||
{"jni_YGNodeStyleSetGapPercentJNI",
|
||||
"(JIF)V",
|
||||
|
@@ -1,393 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<b1b955741beb678b9f3f72a74ad0ae50>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDisplayTest.html
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGDisplayTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void test_display_none() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
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(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, 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(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_fixed_size() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(20f);
|
||||
root_child1.setHeight(20f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
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(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, 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(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMargin(YogaEdge.LEFT, 10f);
|
||||
root_child0.setMargin(YogaEdge.TOP, 10f);
|
||||
root_child0.setMargin(YogaEdge.RIGHT, 10f);
|
||||
root_child0.setMargin(YogaEdge.BOTTOM, 10f);
|
||||
root_child0.setWidth(20f);
|
||||
root_child0.setHeight(20f);
|
||||
root_child0.setDisplay(YogaDisplay.NONE);
|
||||
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(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, 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(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_child() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root_child0.setFlexShrink(1f);
|
||||
root_child0.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexShrink(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child1_child0 = createNode(config);
|
||||
root_child1_child0.setFlexGrow(1f);
|
||||
root_child1_child0.setFlexShrink(1f);
|
||||
root_child1_child0.setFlexBasisPercent(0f);
|
||||
root_child1_child0.setWidth(20f);
|
||||
root_child1.addChildAt(root_child1_child0, 0);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setFlexGrow(1f);
|
||||
root_child2.setFlexShrink(1f);
|
||||
root_child2.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
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(50f, 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(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.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(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_position() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setPosition(YogaEdge.TOP, 10f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
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(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, 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(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_position_absolute() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root_child0.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(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(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(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(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
97
java/tests/com/facebook/yoga/utils/TestUtils.java
Normal file
97
java/tests/com/facebook/yoga/utils/TestUtils.java
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.utils;
|
||||
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import com.facebook.yoga.YogaMeasureOutput;
|
||||
import com.facebook.yoga.YogaMeasureFunction;
|
||||
import com.facebook.yoga.YogaNode;
|
||||
import com.facebook.yoga.YogaFlexDirection;
|
||||
|
||||
public class TestUtils {
|
||||
|
||||
public static class intrinsicMeasureFunction implements YogaMeasureFunction {
|
||||
|
||||
private static float widthPerChar = 10;
|
||||
private static float heightPerChar = 10;
|
||||
|
||||
@Override
|
||||
public long measure(
|
||||
YogaNode node,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode) {
|
||||
String text = (String) node.getData();
|
||||
float measuredWidth;
|
||||
float measuredHeight;
|
||||
|
||||
if (widthMode == YogaMeasureMode.EXACTLY) {
|
||||
measuredWidth = width;
|
||||
} else if (widthMode == YogaMeasureMode.AT_MOST) {
|
||||
measuredWidth = Math.min(text.length() * widthPerChar, width);
|
||||
} else {
|
||||
measuredWidth = text.length() * widthPerChar;
|
||||
}
|
||||
|
||||
if (heightMode == YogaMeasureMode.EXACTLY) {
|
||||
measuredHeight = height;
|
||||
} else if (heightMode == YogaMeasureMode.AT_MOST) {
|
||||
measuredHeight =
|
||||
Math.min(
|
||||
caclulateHeight(text, node.getFlexDirection() == YogaFlexDirection.COLUMN
|
||||
? measuredWidth
|
||||
: Math.max(measuredWidth, getWidestWordWidth(text))), height);
|
||||
} else {
|
||||
measuredHeight = caclulateHeight(text, node.getFlexDirection() == YogaFlexDirection.COLUMN
|
||||
? measuredWidth
|
||||
: Math.max(measuredWidth, getWidestWordWidth(text)));
|
||||
}
|
||||
|
||||
return YogaMeasureOutput.make(measuredWidth, measuredHeight);
|
||||
}
|
||||
|
||||
static float getWidestWordWidth(String text) {
|
||||
int widestWordLength = 0;
|
||||
String[] words = text.split(" ");
|
||||
for (String word : words) {
|
||||
int wordLength = word.length();
|
||||
if (widestWordLength < wordLength) {
|
||||
widestWordLength = wordLength;
|
||||
}
|
||||
}
|
||||
return (float) widestWordLength * widthPerChar;
|
||||
}
|
||||
|
||||
static float caclulateHeight(String text, float measuredWidth) {
|
||||
if (text.length() * widthPerChar <= measuredWidth) {
|
||||
return heightPerChar;
|
||||
}
|
||||
|
||||
String[] words = text.split(" ");
|
||||
float lines = 1;
|
||||
float currentLineLength = 0;
|
||||
for (String word : words) {
|
||||
float wordWidth = word.length() * widthPerChar;
|
||||
if (wordWidth > measuredWidth) {
|
||||
if (currentLineLength > 0) {
|
||||
lines++;
|
||||
}
|
||||
lines++;
|
||||
currentLineLength = 0;
|
||||
} else if (currentLineLength + wordWidth <= measuredWidth) {
|
||||
currentLineLength += wordWidth + widthPerChar;
|
||||
} else {
|
||||
lines++;
|
||||
currentLineLength = wordWidth + widthPerChar;
|
||||
}
|
||||
}
|
||||
return (currentLineLength == 0 ? lines - 1 : lines) * heightPerChar;
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<3ccb0b2604c647cde1c76fc2629a3113>>
|
||||
* @generated SignedSource<<c4a613bef526a87ca88e3b28e1abc215>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAbsolutePositionTest {
|
||||
@@ -69,6 +70,135 @@ public class YGAbsolutePositionTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_left_auto_right() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setPositionAuto(YogaEdge.LEFT);
|
||||
root_child0.setPosition(YogaEdge.RIGHT, 10f);
|
||||
root_child0.setWidth(10f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_left_right_auto() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setPosition(YogaEdge.LEFT, 10f);
|
||||
root_child0.setPositionAuto(YogaEdge.RIGHT);
|
||||
root_child0.setWidth(10f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_left_auto_right_auto() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setPositionAuto(YogaEdge.LEFT);
|
||||
root_child0.setPositionAuto(YogaEdge.RIGHT);
|
||||
root_child0.setWidth(10f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(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(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_end_bottom() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<bd8a962cdd17e27c9a61363c7e25044c>>
|
||||
* @generated SignedSource<<cafd5a49032616243a68af66ae440904>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAlignContentTest {
|
||||
@@ -5206,6 +5207,305 @@ public class YGAlignContentTest {
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_flex_end_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setAlignItems(YogaAlign.FLEX_END);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_START);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(250f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.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(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(250f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_flex_start_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setAlignItems(YogaAlign.FLEX_START);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_END);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.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(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_center_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setAlignItems(YogaAlign.CENTER);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_END);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(38f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.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(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(38f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_stretch_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_END);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.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(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<17eb6adbebe0409ff047a82dc3257d91>>
|
||||
* @generated SignedSource<<e8d11c0e97041bb2f1487f0d87363fdc>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAlignItemsTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<473604215dcf5ee686799fe2c2dc2004>>
|
||||
* @generated SignedSource<<90c29809153285d8773124e93961ba55>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignSelfTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAlignSelfTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<a6047e80a41c4f9d4de130eaba8f57c0>>
|
||||
* @generated SignedSource<<245b1ad71f126cebcb48b66239bbc759>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAndroidNewsFeed {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<474f52d92a8fc32c66d5b5c1cc446124>>
|
||||
* @generated SignedSource<<37a01c67158df025b1b43b8378071746>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAspectRatioTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAspectRatioTest {
|
||||
@@ -178,6 +179,46 @@ public class YGAspectRatioTest {
|
||||
assertEquals(197f, root_child0_child0_child2_child0_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_zero_aspect_ratio_behaves_like_auto() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setAspectRatio(0 / 1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(250f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
325
java/tests/generated/com/facebook/yoga/YGAutoTest.java
Normal file
325
java/tests/generated/com/facebook/yoga/YGAutoTest.java
Normal file
@@ -0,0 +1,325 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<30103b31d09984d8443cf1ba544adeb7>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAutoTest.html
|
||||
*/
|
||||
|
||||
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;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAutoTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void test_auto_width() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidthAuto();
|
||||
root.setHeight(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.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(150f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_height() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
root.setHeightAuto();
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.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(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_flex_basis() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.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(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_position() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
root.setHeight(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionAuto(YogaEdge.RIGHT);
|
||||
root_child0.setWidth(25f);
|
||||
root_child0.setHeight(25f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
root.setHeight(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMarginAuto(YogaEdge.LEFT);
|
||||
root_child0.setWidth(25f);
|
||||
root_child0.setHeight(25f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<c313aae6965f21b021d2dae0af1173bf>>
|
||||
* @generated SignedSource<<d4e5fb968cdc2a3a64ddc14d21e8f867>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBorderTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGBorderTest {
|
2512
java/tests/generated/com/facebook/yoga/YGBoxSizingTest.java
Normal file
2512
java/tests/generated/com/facebook/yoga/YGBoxSizingTest.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<0f79d7debf11777b10de09656cb38147>>
|
||||
* @generated SignedSource<<6a430747c0b764e9fb683f023b45391a>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDimensionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGDimensionTest {
|
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<be0d102e74e15f15050520f21afcaee1>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDisplayContentsTest.html
|
||||
*/
|
||||
|
||||
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;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGDisplayContentsTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void test_test1() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setDisplay(YogaDisplay.CONTENTS);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setFlexGrow(1f);
|
||||
root_child0_child0.setFlexShrink(1f);
|
||||
root_child0_child0.setFlexBasisPercent(0f);
|
||||
root_child0_child0.setHeight(10f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setFlexGrow(1f);
|
||||
root_child0_child1.setFlexShrink(1f);
|
||||
root_child0_child1.setFlexBasisPercent(0f);
|
||||
root_child0_child1.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_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(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_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(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
1030
java/tests/generated/com/facebook/yoga/YGDisplayTest.java
Normal file
1030
java/tests/generated/com/facebook/yoga/YGDisplayTest.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<5bb2b698f40c9c95737a77fff84f7700>>
|
||||
* @generated SignedSource<<5e698842feb033db77ff508df3f33b4a>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexDirectionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGFlexDirectionTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<744d504e2ab572337ace7a2589bc3570>>
|
||||
* @generated SignedSource<<a33d3aa3ed335ded287fa37f788c321c>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGFlexTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<ef62c060fc074248a6d6db6c619f38d4>>
|
||||
* @generated SignedSource<<f977e27ada480c9023d16368fae4fab2>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexWrapTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGFlexWrapTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<bb0dd2eb7bd992caee5efdd08b65a756>>
|
||||
* @generated SignedSource<<feba5f3f4c830be8a570d3a4c9deb8eb>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGGapTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGGapTest {
|
2992
java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java
Normal file
2992
java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<a4f2e216ee29aa4a703244d1e18e5c3b>>
|
||||
* @generated SignedSource<<ebd50ee9980922e7e6f3beabff5375ea>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGJustifyContentTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGJustifyContentTest {
|
||||
@@ -1789,6 +1790,7 @@ public class YGJustifyContentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_justify_content_overflow_row_reverse_space_around() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
@@ -1818,17 +1820,17 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, 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(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
@@ -1841,23 +1843,24 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-18f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(62f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_justify_content_overflow_row_reverse_space_evenly() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
@@ -1887,17 +1890,17 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, 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(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
@@ -1910,17 +1913,17 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-18f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(62f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<be80692a6b8a8fee76e2060f62f9ae36>>
|
||||
* @generated SignedSource<<f9410af3e2849999ef3aec09cebbeef1>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGMarginTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGMarginTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<857e5626695bb6b524eb6b609a6c7b55>>
|
||||
* @generated SignedSource<<19cdc4fc9425af726b656ef628bab8af>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGMinMaxDimensionTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<e7b2dc11dc748322103e0c8d1196dc64>>
|
||||
* @generated SignedSource<<6116c0f130b77b635a6551b3204c3cf8>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGPaddingTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGPaddingTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<baefd1632c2e9c66e4c42114856aa74f>>
|
||||
* @generated SignedSource<<27e18496d4ee880d9ba95ad0b2648071>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGPercentageTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGPercentageTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<40959004b04825e4f8f58e8a6d796047>>
|
||||
* @generated SignedSource<<06c18c6b3b9735644daf5b5bd0777eb8>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGRoundingTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGRoundingTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<debde6a37b3a2ad5892a15611a2fa8ec>>
|
||||
* @generated SignedSource<<26e773ec772f84370bc0f3f53d8221ed>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGSizeOverflowTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGSizeOverflowTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<3bbbf27ae54f7b245d6adad352761339>>
|
||||
* @generated SignedSource<<997d12880828a3c2881898b769618b43>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGStaticPositionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGStaticPositionTest {
|
||||
@@ -5886,6 +5887,144 @@ public class YGStaticPositionTest {
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_static_position_absolute_child_multiple() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPadding(YogaEdge.LEFT, 100);
|
||||
root_child0.setPadding(YogaEdge.TOP, 100);
|
||||
root_child0.setPadding(YogaEdge.RIGHT, 100);
|
||||
root_child0.setPadding(YogaEdge.BOTTOM, 100);
|
||||
root_child0.setWidth(400f);
|
||||
root_child0.setHeight(400f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setPositionType(YogaPositionType.STATIC);
|
||||
root_child0_child0.setWidth(100f);
|
||||
root_child0_child0.setHeight(100f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0 = createNode(config);
|
||||
root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child0_child0.setWidthPercent(10f);
|
||||
root_child0_child0_child0.setHeight(50f);
|
||||
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setPositionType(YogaPositionType.STATIC);
|
||||
root_child0_child1.setWidth(100f);
|
||||
root_child0_child1.setHeight(100f);
|
||||
root_child0.addChildAt(root_child0_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child1_child0 = createNode(config);
|
||||
root_child0_child1_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child1_child0.setWidthPercent(50f);
|
||||
root_child0_child1_child0.setHeight(50f);
|
||||
root_child0_child1.addChildAt(root_child0_child1_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1_child1 = createNode(config);
|
||||
root_child0_child1_child1.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child1_child1.setWidthPercent(50f);
|
||||
root_child0_child1_child1.setHeight(50f);
|
||||
root_child0_child1.addChildAt(root_child0_child1_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child2 = createNode(config);
|
||||
root_child0_child2.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child2.setWidth(25f);
|
||||
root_child0_child2.setHeight(50f);
|
||||
root_child0.addChildAt(root_child0_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child1_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child2.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(400f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-100f, root_child0_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-100f, root_child0_child1_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(275f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -23,7 +23,7 @@ const {
|
||||
const {existsSync} = require('fs');
|
||||
const {readFile, writeFile, rm} = require('fs/promises');
|
||||
|
||||
const glob = require('glob');
|
||||
const {glob} = require('glob');
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yoga-layout",
|
||||
"version": "3.1.0",
|
||||
"version": "0.0.0",
|
||||
"description": "An embeddable and performant flexbox layout engine with bindings for multiple languages",
|
||||
"license": "MIT",
|
||||
"author": "Meta Open Source",
|
||||
@@ -38,14 +38,13 @@
|
||||
"@babel/core": "^7.23.0",
|
||||
"@babel/preset-env": "^7.23.0",
|
||||
"@babel/preset-typescript": "^7.23.0",
|
||||
"@types/glob": "^8.1.0",
|
||||
"@types/jest": "^29.5.1",
|
||||
"@types/node": "^16.18.25",
|
||||
"@types/which": "^3.0.0",
|
||||
"@yogalayout/cmake-bin": "3.28.0-1",
|
||||
"babel-register-esm": "^1.2.5",
|
||||
"clang-format": "^1.8.0",
|
||||
"glob": "^8.0.3",
|
||||
"glob": "^10.4.2",
|
||||
"jest": "^29.3.1",
|
||||
"just-scripts": "^2.1.0",
|
||||
"ninja-binaries": "^1.11.1",
|
||||
|
@@ -75,6 +75,10 @@ void Node::copyStyle(Node const& other) {
|
||||
YGNodeCopyStyle(m_node, other.m_node);
|
||||
}
|
||||
|
||||
void Node::setBoxSizing(int boxSizing) {
|
||||
YGNodeStyleSetBoxSizing(m_node, static_cast<YGBoxSizing>(boxSizing));
|
||||
}
|
||||
|
||||
void Node::setPositionType(int positionType) {
|
||||
YGNodeStyleSetPositionType(m_node, static_cast<YGPositionType>(positionType));
|
||||
}
|
||||
@@ -87,6 +91,10 @@ void Node::setPositionPercent(int edge, double position) {
|
||||
YGNodeStyleSetPositionPercent(m_node, static_cast<YGEdge>(edge), position);
|
||||
}
|
||||
|
||||
void Node::setPositionAuto(int edge) {
|
||||
YGNodeStyleSetPositionAuto(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
void Node::setAlignContent(int alignContent) {
|
||||
YGNodeStyleSetAlignContent(m_node, static_cast<YGAlign>(alignContent));
|
||||
}
|
||||
@@ -152,6 +160,18 @@ void Node::setFlexBasisAuto() {
|
||||
YGNodeStyleSetFlexBasisAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisMaxContent() {
|
||||
YGNodeStyleSetFlexBasisMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisFitContent() {
|
||||
YGNodeStyleSetFlexBasisFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisStretch() {
|
||||
YGNodeStyleSetFlexBasisStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexGrow(double flexGrow) {
|
||||
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
||||
}
|
||||
@@ -172,6 +192,18 @@ void Node::setWidthAuto() {
|
||||
YGNodeStyleSetWidthAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthMaxContent() {
|
||||
YGNodeStyleSetWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthFitContent() {
|
||||
YGNodeStyleSetWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthStretch() {
|
||||
YGNodeStyleSetWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeight(double height) {
|
||||
YGNodeStyleSetHeight(m_node, height);
|
||||
}
|
||||
@@ -184,6 +216,18 @@ void Node::setHeightAuto() {
|
||||
YGNodeStyleSetHeightAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightMaxContent() {
|
||||
YGNodeStyleSetHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightFitContent() {
|
||||
YGNodeStyleSetHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightStretch() {
|
||||
YGNodeStyleSetHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidth(double minWidth) {
|
||||
YGNodeStyleSetMinWidth(m_node, minWidth);
|
||||
}
|
||||
@@ -192,6 +236,18 @@ void Node::setMinWidthPercent(double minWidth) {
|
||||
YGNodeStyleSetMinWidthPercent(m_node, minWidth);
|
||||
}
|
||||
|
||||
void Node::setMinWidthMaxContent() {
|
||||
YGNodeStyleSetMinWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidthFitContent() {
|
||||
YGNodeStyleSetMinWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidthStretch() {
|
||||
YGNodeStyleSetMinWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeight(double minHeight) {
|
||||
YGNodeStyleSetMinHeight(m_node, minHeight);
|
||||
}
|
||||
@@ -200,6 +256,18 @@ void Node::setMinHeightPercent(double minHeight) {
|
||||
YGNodeStyleSetMinHeightPercent(m_node, minHeight);
|
||||
}
|
||||
|
||||
void Node::setMinHeightMaxContent() {
|
||||
YGNodeStyleSetMinHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeightFitContent() {
|
||||
YGNodeStyleSetMinHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeightStretch() {
|
||||
YGNodeStyleSetMinHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidth(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
||||
}
|
||||
@@ -208,6 +276,18 @@ void Node::setMaxWidthPercent(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidthPercent(m_node, maxWidth);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthMaxContent() {
|
||||
YGNodeStyleSetMaxWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthFitContent() {
|
||||
YGNodeStyleSetMaxWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthStretch() {
|
||||
YGNodeStyleSetMaxWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeight(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
||||
}
|
||||
@@ -216,6 +296,18 @@ void Node::setMaxHeightPercent(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeightPercent(m_node, maxHeight);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightMaxContent() {
|
||||
YGNodeStyleSetMaxHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightFitContent() {
|
||||
YGNodeStyleSetMaxHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightStretch() {
|
||||
YGNodeStyleSetMaxHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setAspectRatio(double aspectRatio) {
|
||||
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
||||
}
|
||||
@@ -244,6 +336,10 @@ void Node::setGapPercent(int gutter, double gapLength) {
|
||||
YGNodeStyleSetGapPercent(m_node, static_cast<YGGutter>(gutter), gapLength);
|
||||
}
|
||||
|
||||
int Node::getBoxSizing(void) const {
|
||||
return YGNodeStyleGetBoxSizing(m_node);
|
||||
}
|
||||
|
||||
int Node::getPositionType(void) const {
|
||||
return YGNodeStyleGetPositionType(m_node);
|
||||
}
|
||||
@@ -343,8 +439,9 @@ Value Node::getPadding(int edge) const {
|
||||
YGNodeStyleGetPadding(m_node, static_cast<YGEdge>(edge)));
|
||||
}
|
||||
|
||||
float Node::getGap(int gutter) {
|
||||
return YGNodeStyleGetGap(m_node, static_cast<YGGutter>(gutter));
|
||||
Value Node::getGap(int gutter) const {
|
||||
return Value::fromYGValue(
|
||||
YGNodeStyleGetGap(m_node, static_cast<YGGutter>(gutter)));
|
||||
}
|
||||
|
||||
bool Node::isReferenceBaseline() {
|
||||
|
@@ -76,6 +76,7 @@ class Node {
|
||||
void setPositionType(int positionType);
|
||||
void setPosition(int edge, double position);
|
||||
void setPositionPercent(int edge, double position);
|
||||
void setPositionAuto(int edge);
|
||||
|
||||
void setAlignContent(int alignContent);
|
||||
void setAlignItems(int alignItems);
|
||||
@@ -96,25 +97,46 @@ class Node {
|
||||
void setFlexBasis(double flexBasis);
|
||||
void setFlexBasisPercent(double flexBasis);
|
||||
void setFlexBasisAuto();
|
||||
void setFlexBasisMaxContent();
|
||||
void setFlexBasisFitContent();
|
||||
void setFlexBasisStretch();
|
||||
void setFlexGrow(double flexGrow);
|
||||
void setFlexShrink(double flexShrink);
|
||||
|
||||
void setWidth(double width);
|
||||
void setWidthPercent(double width);
|
||||
void setWidthAuto();
|
||||
void setWidthMaxContent();
|
||||
void setWidthFitContent();
|
||||
void setWidthStretch();
|
||||
void setHeight(double height);
|
||||
void setHeightPercent(double height);
|
||||
void setHeightAuto();
|
||||
void setHeightMaxContent();
|
||||
void setHeightFitContent();
|
||||
void setHeightStretch();
|
||||
|
||||
void setMinWidth(double minWidth);
|
||||
void setMinWidthPercent(double minWidth);
|
||||
void setMinWidthMaxContent();
|
||||
void setMinWidthFitContent();
|
||||
void setMinWidthStretch();
|
||||
void setMinHeight(double minHeight);
|
||||
void setMinHeightPercent(double minHeight);
|
||||
void setMinHeightMaxContent();
|
||||
void setMinHeightFitContent();
|
||||
void setMinHeightStretch();
|
||||
|
||||
void setMaxWidth(double maxWidth);
|
||||
void setMaxWidthPercent(double maxWidth);
|
||||
void setMaxWidthMaxContent();
|
||||
void setMaxWidthFitContent();
|
||||
void setMaxWidthStretch();
|
||||
void setMaxHeight(double maxHeight);
|
||||
void setMaxHeightPercent(double maxHeight);
|
||||
void setMaxHeightMaxContent();
|
||||
void setMaxHeightFitContent();
|
||||
void setMaxHeightStretch();
|
||||
|
||||
void setAspectRatio(double aspectRatio);
|
||||
|
||||
@@ -126,6 +148,8 @@ class Node {
|
||||
void setGap(int gutter, double gapLength);
|
||||
void setGapPercent(int gutter, double gapLength);
|
||||
|
||||
void setBoxSizing(int boxSizing);
|
||||
|
||||
public: // Style getters
|
||||
int getPositionType(void) const;
|
||||
Value getPosition(int edge) const;
|
||||
@@ -162,7 +186,9 @@ class Node {
|
||||
|
||||
Value getPadding(int edge) const;
|
||||
|
||||
float getGap(int gutter);
|
||||
Value getGap(int gutter) const;
|
||||
|
||||
int getBoxSizing(void) const;
|
||||
|
||||
public: // Tree hierarchy mutators
|
||||
void insertChild(Node* child, unsigned index);
|
||||
|
@@ -70,6 +70,7 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("setPositionType", &Node::setPositionType)
|
||||
.function("setPosition", &Node::setPosition)
|
||||
.function("setPositionPercent", &Node::setPositionPercent)
|
||||
.function("setPositionAuto", &Node::setPositionAuto)
|
||||
|
||||
.function("setAlignContent", &Node::setAlignContent)
|
||||
.function("setAlignItems", &Node::setAlignItems)
|
||||
@@ -89,25 +90,48 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("setFlexBasis", &Node::setFlexBasis)
|
||||
.function("setFlexBasisPercent", &Node::setFlexBasisPercent)
|
||||
.function("setFlexBasisAuto", &Node::setFlexBasisAuto)
|
||||
.function("setFlexBasisMaxContent", &Node::setFlexBasisMaxContent)
|
||||
.function("setFlexBasisFitContent", &Node::setFlexBasisFitContent)
|
||||
.function("setFlexBasisStretch", &Node::setFlexBasisStretch)
|
||||
.function("setFlexGrow", &Node::setFlexGrow)
|
||||
.function("setFlexShrink", &Node::setFlexShrink)
|
||||
|
||||
.function("setWidth", &Node::setWidth)
|
||||
.function("setWidthPercent", &Node::setWidthPercent)
|
||||
.function("setWidthAuto", &Node::setWidthAuto)
|
||||
.function("setWidthMaxContent", &Node::setWidthMaxContent)
|
||||
.function("setWidthFitContent", &Node::setWidthFitContent)
|
||||
.function("setWidthStretch", &Node::setWidthStretch)
|
||||
.function("setHeight", &Node::setHeight)
|
||||
.function("setHeightPercent", &Node::setHeightPercent)
|
||||
.function("setHeightAuto", &Node::setHeightAuto)
|
||||
.function("setHeightMaxContent", &Node::setHeightMaxContent)
|
||||
.function("setHeightFitContent", &Node::setHeightFitContent)
|
||||
.function("setHeightStretch", &Node::setHeightStretch)
|
||||
|
||||
.function("setMinWidth", &Node::setMinWidth)
|
||||
.function("setMinWidthPercent", &Node::setMinWidthPercent)
|
||||
.function("setMinWidthMaxContent", &Node::setMinWidthMaxContent)
|
||||
.function("setMinWidthFitContent", &Node::setMinWidthFitContent)
|
||||
.function("setMinWidthStretch", &Node::setMinWidthStretch)
|
||||
.function("setMinHeight", &Node::setMinHeight)
|
||||
.function("setMinHeightPercent", &Node::setMinHeightPercent)
|
||||
.function("setMinHeightMaxContent", &Node::setMinHeightMaxContent)
|
||||
.function("setMinHeightFitContent", &Node::setMinHeightFitContent)
|
||||
.function("setMinHeightStretch", &Node::setMinHeightStretch)
|
||||
|
||||
.function("setMaxWidth", &Node::setMaxWidth)
|
||||
.function("setMaxWidthPercent", &Node::setMaxWidthPercent)
|
||||
.function("setMaxWidthMaxContent", &Node::setMaxWidthMaxContent)
|
||||
.function("setMaxWidthFitContent", &Node::setMaxWidthFitContent)
|
||||
.function("setMaxWidthStretch", &Node::setMaxWidthStretch)
|
||||
.function("setMaxHeight", &Node::setMaxHeight)
|
||||
.function("setMaxHeightPercent", &Node::setMaxHeightPercent)
|
||||
.function("setMaxHeightMaxContent", &Node::setMaxHeightMaxContent)
|
||||
.function("setMaxHeightFitContent", &Node::setMaxHeightFitContent)
|
||||
.function("setMaxHeightStretch", &Node::setMaxHeightStretch)
|
||||
|
||||
.function("setBoxSizing", &Node::setBoxSizing)
|
||||
|
||||
.function("setAspectRatio", &Node::setAspectRatio)
|
||||
|
||||
@@ -145,6 +169,8 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("getMaxWidth", &Node::getMaxWidth)
|
||||
.function("getMaxHeight", &Node::getMaxHeight)
|
||||
|
||||
.function("getBoxSizing", &Node::getBoxSizing)
|
||||
|
||||
.function("getAspectRatio", &Node::getAspectRatio)
|
||||
|
||||
.function("getBorder", &Node::getBorder)
|
||||
|
@@ -19,6 +19,11 @@ export enum Align {
|
||||
SpaceEvenly = 8,
|
||||
}
|
||||
|
||||
export enum BoxSizing {
|
||||
BorderBox = 0,
|
||||
ContentBox = 1,
|
||||
}
|
||||
|
||||
export enum Dimension {
|
||||
Width = 0,
|
||||
Height = 1,
|
||||
@@ -33,6 +38,7 @@ export enum Direction {
|
||||
export enum Display {
|
||||
Flex = 0,
|
||||
None = 1,
|
||||
Contents = 2,
|
||||
}
|
||||
|
||||
export enum Edge {
|
||||
@@ -50,7 +56,7 @@ export enum Edge {
|
||||
export enum Errata {
|
||||
None = 0,
|
||||
StretchFlexBasis = 1,
|
||||
AbsolutePositioningIncorrect = 2,
|
||||
AbsolutePositionWithoutInsetsExcludesPadding = 2,
|
||||
AbsolutePercentAgainstInnerSize = 4,
|
||||
All = 2147483647,
|
||||
Classic = 2147483646,
|
||||
@@ -119,6 +125,9 @@ export enum Unit {
|
||||
Point = 1,
|
||||
Percent = 2,
|
||||
Auto = 3,
|
||||
MaxContent = 4,
|
||||
FitContent = 5,
|
||||
Stretch = 6,
|
||||
}
|
||||
|
||||
export enum Wrap {
|
||||
@@ -137,6 +146,8 @@ const constants = {
|
||||
ALIGN_SPACE_BETWEEN: Align.SpaceBetween,
|
||||
ALIGN_SPACE_AROUND: Align.SpaceAround,
|
||||
ALIGN_SPACE_EVENLY: Align.SpaceEvenly,
|
||||
BOX_SIZING_BORDER_BOX: BoxSizing.BorderBox,
|
||||
BOX_SIZING_CONTENT_BOX: BoxSizing.ContentBox,
|
||||
DIMENSION_WIDTH: Dimension.Width,
|
||||
DIMENSION_HEIGHT: Dimension.Height,
|
||||
DIRECTION_INHERIT: Direction.Inherit,
|
||||
@@ -144,6 +155,7 @@ const constants = {
|
||||
DIRECTION_RTL: Direction.RTL,
|
||||
DISPLAY_FLEX: Display.Flex,
|
||||
DISPLAY_NONE: Display.None,
|
||||
DISPLAY_CONTENTS: Display.Contents,
|
||||
EDGE_LEFT: Edge.Left,
|
||||
EDGE_TOP: Edge.Top,
|
||||
EDGE_RIGHT: Edge.Right,
|
||||
@@ -155,7 +167,7 @@ const constants = {
|
||||
EDGE_ALL: Edge.All,
|
||||
ERRATA_NONE: Errata.None,
|
||||
ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis,
|
||||
ERRATA_ABSOLUTE_POSITIONING_INCORRECT: Errata.AbsolutePositioningIncorrect,
|
||||
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: Errata.AbsolutePositionWithoutInsetsExcludesPadding,
|
||||
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: Errata.AbsolutePercentAgainstInnerSize,
|
||||
ERRATA_ALL: Errata.All,
|
||||
ERRATA_CLASSIC: Errata.Classic,
|
||||
@@ -194,6 +206,9 @@ const constants = {
|
||||
UNIT_POINT: Unit.Point,
|
||||
UNIT_PERCENT: Unit.Percent,
|
||||
UNIT_AUTO: Unit.Auto,
|
||||
UNIT_MAX_CONTENT: Unit.MaxContent,
|
||||
UNIT_FIT_CONTENT: Unit.FitContent,
|
||||
UNIT_STRETCH: Unit.Stretch,
|
||||
WRAP_NO_WRAP: Wrap.NoWrap,
|
||||
WRAP_WRAP: Wrap.Wrap,
|
||||
WRAP_WRAP_REVERSE: Wrap.WrapReverse,
|
||||
|
@@ -14,6 +14,7 @@ import YGEnums from './generated/YGEnums.ts';
|
||||
|
||||
import type {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
@@ -115,6 +116,7 @@ export type Node = {
|
||||
getParent(): Node | null;
|
||||
getPosition(edge: Edge): Value;
|
||||
getPositionType(): PositionType;
|
||||
getBoxSizing(): BoxSizing;
|
||||
getWidth(): Value;
|
||||
insertChild(child: Node, index: number): void;
|
||||
isDirty(): boolean;
|
||||
@@ -132,17 +134,41 @@ export type Node = {
|
||||
setDirection(direction: Direction): void;
|
||||
setDisplay(display: Display): void;
|
||||
setFlex(flex: number | undefined): void;
|
||||
setFlexBasis(flexBasis: number | 'auto' | `${number}%` | undefined): void;
|
||||
setFlexBasis(
|
||||
flexBasis:
|
||||
| number
|
||||
| 'auto'
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setFlexBasisPercent(flexBasis: number | undefined): void;
|
||||
setFlexBasisAuto(): void;
|
||||
setFlexBasisFitContent(): void;
|
||||
setFlexBasisMaxContent(): void;
|
||||
setFlexBasisStretch(): void;
|
||||
setFlexDirection(flexDirection: FlexDirection): void;
|
||||
setFlexGrow(flexGrow: number | undefined): void;
|
||||
setFlexShrink(flexShrink: number | undefined): void;
|
||||
setFlexWrap(flexWrap: Wrap): void;
|
||||
setHeight(height: number | 'auto' | `${number}%` | undefined): void;
|
||||
setHeight(
|
||||
height:
|
||||
| number
|
||||
| 'auto'
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setIsReferenceBaseline(isReferenceBaseline: boolean): void;
|
||||
setHeightAuto(): void;
|
||||
setHeightFitContent(): void;
|
||||
setHeightMaxContent(): void;
|
||||
setHeightPercent(height: number | undefined): void;
|
||||
setHeightStretch(): void;
|
||||
setJustifyContent(justifyContent: Justify): void;
|
||||
setGap(gutter: Gutter, gapLength: number | `${number}%` | undefined): Value;
|
||||
setGapPercent(gutter: Gutter, gapLength: number | undefined): Value;
|
||||
@@ -152,25 +178,83 @@ export type Node = {
|
||||
): void;
|
||||
setMarginAuto(edge: Edge): void;
|
||||
setMarginPercent(edge: Edge, margin: number | undefined): void;
|
||||
setMaxHeight(maxHeight: number | `${number}%` | undefined): void;
|
||||
setMaxHeight(
|
||||
maxHeight:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMaxHeightFitContent(): void;
|
||||
setMaxHeightMaxContent(): void;
|
||||
setMaxHeightPercent(maxHeight: number | undefined): void;
|
||||
setMaxWidth(maxWidth: number | `${number}%` | undefined): void;
|
||||
setMaxHeightStretch(): void;
|
||||
setMaxWidth(
|
||||
maxWidth:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMaxWidthFitContent(): void;
|
||||
setMaxWidthMaxContent(): void;
|
||||
setMaxWidthPercent(maxWidth: number | undefined): void;
|
||||
setMaxWidthStretch(): void;
|
||||
setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void;
|
||||
setMeasureFunc(measureFunc: MeasureFunction | null): void;
|
||||
setMinHeight(minHeight: number | `${number}%` | undefined): void;
|
||||
setMinHeight(
|
||||
minHeight:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMinHeightFitContent(): void;
|
||||
setMinHeightMaxContent(): void;
|
||||
setMinHeightPercent(minHeight: number | undefined): void;
|
||||
setMinWidth(minWidth: number | `${number}%` | undefined): void;
|
||||
setMinHeightStretch(): void;
|
||||
setMinWidth(
|
||||
minWidth:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMinWidthFitContent(): void;
|
||||
setMinWidthMaxContent(): void;
|
||||
setMinWidthPercent(minWidth: number | undefined): void;
|
||||
setMinWidthStretch(): void;
|
||||
setOverflow(overflow: Overflow): void;
|
||||
setPadding(edge: Edge, padding: number | `${number}%` | undefined): void;
|
||||
setPaddingPercent(edge: Edge, padding: number | undefined): void;
|
||||
setPosition(edge: Edge, position: number | `${number}%` | undefined): void;
|
||||
setPositionPercent(edge: Edge, position: number | undefined): void;
|
||||
setPositionType(positionType: PositionType): void;
|
||||
setWidth(width: number | 'auto' | `${number}%` | undefined): void;
|
||||
setPositionAuto(edge: Edge): void;
|
||||
setBoxSizing(boxSizing: BoxSizing): void;
|
||||
setWidth(
|
||||
width:
|
||||
| number
|
||||
| 'auto'
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setWidthAuto(): void;
|
||||
setWidthFitContent(): void;
|
||||
setWidthMaxContent(): void;
|
||||
setWidthPercent(width: number | undefined): void;
|
||||
setWidthStretch(): void;
|
||||
unsetDirtiedFunc(): void;
|
||||
unsetMeasureFunc(): void;
|
||||
setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void;
|
||||
@@ -216,6 +300,9 @@ export default function wrapAssembly(lib: any): Yoga {
|
||||
[Unit.Point]: lib.Node.prototype[fnName],
|
||||
[Unit.Percent]: lib.Node.prototype[`${fnName}Percent`],
|
||||
[Unit.Auto]: lib.Node.prototype[`${fnName}Auto`],
|
||||
[Unit.MaxContent]: lib.Node.prototype[`${fnName}MaxContent`],
|
||||
[Unit.FitContent]: lib.Node.prototype[`${fnName}FitContent`],
|
||||
[Unit.Stretch]: lib.Node.prototype[`${fnName}Stretch`],
|
||||
};
|
||||
|
||||
patch(lib.Node.prototype, fnName, function (original, ...args) {
|
||||
@@ -228,6 +315,15 @@ export default function wrapAssembly(lib: any): Yoga {
|
||||
if (value === 'auto') {
|
||||
unit = Unit.Auto;
|
||||
asNumber = undefined;
|
||||
} else if (value == 'max-content') {
|
||||
unit = Unit.MaxContent;
|
||||
asNumber = undefined;
|
||||
} else if (value == 'fit-content') {
|
||||
unit = Unit.FitContent;
|
||||
asNumber = undefined;
|
||||
} else if (value == 'stretch') {
|
||||
unit = Unit.Stretch;
|
||||
asNumber = undefined;
|
||||
} else if (typeof value === 'object') {
|
||||
unit = value.unit;
|
||||
asNumber = value.valueOf();
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<9c27293180ef7ffd5b683046588f9dd7>>
|
||||
* @generated SignedSource<<9deb466dfc94bb340137a9e6b5d5c63d>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
@@ -74,6 +76,150 @@ test('absolute_layout_width_height_start_top', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('absolute_layout_width_height_left_auto_right', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Absolute);
|
||||
root_child0.setPositionAuto(Edge.Left);
|
||||
root_child0.setPosition(Edge.Right, 10);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(80);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(80);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('absolute_layout_width_height_left_right_auto', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Absolute);
|
||||
root_child0.setPosition(Edge.Left, 10);
|
||||
root_child0.setPositionAuto(Edge.Right);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(10);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(10);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('absolute_layout_width_height_left_auto_right_auto', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Absolute);
|
||||
root_child0.setPositionAuto(Edge.Left);
|
||||
root_child0.setPositionAuto(Edge.Right);
|
||||
root_child0.setWidth(10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(90);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('absolute_layout_width_height_end_bottom', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<a74026bab03aecc7776f5dbb34f233a1>>
|
||||
* @generated SignedSource<<ae2a56d91c60e30ea10b12d6d143ff73>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
@@ -5506,3 +5508,322 @@ test('align_content_space_evenly_stretch_does_influence_line_box_dim', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('align_content_stretch_and_align_items_flex_end_with_flex_wrap', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setAlignItems(Align.FlexEnd);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(300);
|
||||
root.setHeight(300);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Align.FlexStart);
|
||||
root_child0.setWidth(150);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(120);
|
||||
root_child1.setHeight(100);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(120);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(75);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(250);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(150);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(30);
|
||||
expect(root_child1.getComputedTop()).toBe(75);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(180);
|
||||
expect(root_child2.getComputedTop()).toBe(250);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('align_content_stretch_and_align_items_flex_start_with_flex_wrap', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setAlignItems(Align.FlexStart);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(300);
|
||||
root.setHeight(300);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Align.FlexEnd);
|
||||
root_child0.setWidth(150);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(120);
|
||||
root_child1.setHeight(100);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(120);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(125);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(175);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(150);
|
||||
expect(root_child0.getComputedTop()).toBe(125);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(30);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(180);
|
||||
expect(root_child2.getComputedTop()).toBe(175);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('align_content_stretch_and_align_items_center_with_flex_wrap', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(300);
|
||||
root.setHeight(300);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Align.FlexEnd);
|
||||
root_child0.setWidth(150);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(120);
|
||||
root_child1.setHeight(100);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(120);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(125);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(38);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(213);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(150);
|
||||
expect(root_child0.getComputedTop()).toBe(125);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(30);
|
||||
expect(root_child1.getComputedTop()).toBe(38);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(180);
|
||||
expect(root_child2.getComputedTop()).toBe(213);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('align_content_stretch_and_align_items_stretch_with_flex_wrap', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(300);
|
||||
root.setHeight(300);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Align.FlexEnd);
|
||||
root_child0.setWidth(150);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(120);
|
||||
root_child1.setHeight(100);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(120);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(125);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(175);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(150);
|
||||
expect(root_child0.getComputedTop()).toBe(125);
|
||||
expect(root_child0.getComputedWidth()).toBe(150);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(30);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(120);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(180);
|
||||
expect(root_child2.getComputedTop()).toBe(175);
|
||||
expect(root_child2.getComputedWidth()).toBe(120);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<74d05d33189c5b8e301d7bb50e219a07>>
|
||||
* @generated SignedSource<<075a0b67003e5c4a1f51bd99da71c700>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<353dcfc198766f52fa7a84b1f47fab23>>
|
||||
* @generated SignedSource<<1badc9ed5a0cb8d9a4a1b23653cfbe58>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignSelfTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<f3c61c97032ebe1518e40730efe8a392>>
|
||||
* @generated SignedSource<<e79ac212057a324d3ce2808face5a71c>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<f2cef5ee14439a52c41c7aa6a29d176a>>
|
||||
* @generated SignedSource<<57064c3213fc22e0637ae5768ce6fea5>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAspectRatioTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
@@ -182,3 +184,48 @@ test.skip('aspect_ratio_does_not_stretch_cross_axis_dim', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('zero_aspect_ratio_behaves_like_auto', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(300);
|
||||
root.setHeight(300);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setAspectRatio(0 / 1);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(300);
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(250);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
|
347
javascript/tests/generated/YGAutoTest.test.ts
Normal file
347
javascript/tests/generated/YGAutoTest.test.ts
Normal file
@@ -0,0 +1,347 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<234cdb7f76ac586e034a5b6ca2033fa4>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAutoTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('auto_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth('auto');
|
||||
root.setHeight(50);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(150);
|
||||
expect(root.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(100);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(150);
|
||||
expect(root.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(100);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('auto_height', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(50);
|
||||
root.setHeight('auto');
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(150);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(50);
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(100);
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(150);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(50);
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(100);
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('auto_flex_basis', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(50);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(150);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(50);
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(100);
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(150);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(50);
|
||||
expect(root_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child1.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(100);
|
||||
expect(root_child2.getComputedWidth()).toBe(50);
|
||||
expect(root_child2.getComputedHeight()).toBe(50);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('auto_position', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(50);
|
||||
root.setHeight(50);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionAuto(Edge.Right);
|
||||
root_child0.setWidth(25);
|
||||
root_child0.setHeight(25);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child0.getComputedHeight()).toBe(25);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(25);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child0.getComputedHeight()).toBe(25);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('auto_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(50);
|
||||
root.setHeight(50);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setWidth(25);
|
||||
root_child0.setHeight(25);
|
||||
root.insertChild(root_child0, 0);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(25);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child0.getComputedHeight()).toBe(25);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(50);
|
||||
expect(root.getComputedHeight()).toBe(50);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(25);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child0.getComputedHeight()).toBe(25);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<27363e405aac02603d06d5f06fa107ba>>
|
||||
* @generated SignedSource<<b1aa13bd88fcb494afb2db9bd80c40e0>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBorderTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
2747
javascript/tests/generated/YGBoxSizingTest.test.ts
Normal file
2747
javascript/tests/generated/YGBoxSizingTest.test.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<557b8f6c7b3abd35d4f10cc83c650caf>>
|
||||
* @generated SignedSource<<719c8f3b9fea672881a47f593f4aabd0>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDimensionTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
109
javascript/tests/generated/YGDisplayContentsTest.test.ts
Normal file
109
javascript/tests/generated/YGDisplayContentsTest.test.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<64d58fa2d33230f4eafc9ecbb6012a0d>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDisplayContentsTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
Errata,
|
||||
ExperimentalFeature,
|
||||
FlexDirection,
|
||||
Gutter,
|
||||
Justify,
|
||||
MeasureMode,
|
||||
Overflow,
|
||||
PositionType,
|
||||
Unit,
|
||||
Wrap,
|
||||
} from 'yoga-layout';
|
||||
|
||||
test('test1', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexShrink(1);
|
||||
root_child0_child0.setFlexBasis("0%");
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setFlexGrow(1);
|
||||
root_child0_child1.setFlexShrink(1);
|
||||
root_child0_child1.setFlexBasis("0%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<f84185922c678ddf892c13ccbd3b79f2>>
|
||||
* @generated SignedSource<<ef1ab99e8f13c0a59342ca17f63181ef>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDisplayTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
@@ -417,3 +419,679 @@ test('display_none_with_position_absolute', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexShrink(1);
|
||||
root_child0_child0.setFlexBasis("0%");
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setFlexGrow(1);
|
||||
root_child0_child1.setFlexShrink(1);
|
||||
root_child0_child1.setFlexBasis("0%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents_fixed_size', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root_child0.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexShrink(1);
|
||||
root_child0_child0.setFlexBasis("0%");
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setFlexGrow(1);
|
||||
root_child0_child1.setFlexShrink(1);
|
||||
root_child0_child1.setFlexBasis("0%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents_with_margin', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
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(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setFlexGrow(1);
|
||||
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(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(100);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents_with_padding', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
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_child0.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexShrink(1);
|
||||
root_child0_child0.setFlexBasis("0%");
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setFlexGrow(1);
|
||||
root_child0_child1.setFlexShrink(1);
|
||||
root_child0_child1.setFlexBasis("0%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents_with_position', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPosition(Edge.Top, 10);
|
||||
root_child0.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexShrink(1);
|
||||
root_child0_child0.setFlexBasis("0%");
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setFlexGrow(1);
|
||||
root_child0_child1.setFlexShrink(1);
|
||||
root_child0_child1.setFlexBasis("0%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents_with_position_absolute', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Absolute);
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root_child0.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0.setFlexShrink(1);
|
||||
root_child0_child0.setFlexBasis("0%");
|
||||
root_child0_child0.setHeight(10);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setFlexGrow(1);
|
||||
root_child0_child1.setFlexShrink(1);
|
||||
root_child0_child1.setFlexBasis("0%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents_nested', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setDisplay(Display.Contents);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0_child0.setFlexGrow(1);
|
||||
root_child0_child0_child0.setFlexShrink(1);
|
||||
root_child0_child0_child0.setFlexBasis("0%");
|
||||
root_child0_child0_child0.setHeight(10);
|
||||
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||
|
||||
const root_child0_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child0_child1.setFlexGrow(1);
|
||||
root_child0_child0_child1.setFlexShrink(1);
|
||||
root_child0_child0_child1.setFlexBasis("0%");
|
||||
root_child0_child0_child1.setHeight(20);
|
||||
root_child0_child0.insertChild(root_child0_child0_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(0);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child0_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child0_child0_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0_child1.getComputedWidth()).toBe(50);
|
||||
expect(root_child0_child0_child1.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('display_contents_with_siblings', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexShrink(1);
|
||||
root_child0.setFlexBasis("0%");
|
||||
root_child0.setHeight(30);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setDisplay(Display.Contents);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child1_child0 = Yoga.Node.create(config);
|
||||
root_child1_child0.setFlexGrow(1);
|
||||
root_child1_child0.setFlexShrink(1);
|
||||
root_child1_child0.setFlexBasis("0%");
|
||||
root_child1_child0.setHeight(10);
|
||||
root_child1.insertChild(root_child1_child0, 0);
|
||||
|
||||
const root_child1_child1 = Yoga.Node.create(config);
|
||||
root_child1_child1.setFlexGrow(1);
|
||||
root_child1_child1.setFlexShrink(1);
|
||||
root_child1_child1.setFlexBasis("0%");
|
||||
root_child1_child1.setHeight(20);
|
||||
root_child1.insertChild(root_child1_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setFlexShrink(1);
|
||||
root_child2.setFlexBasis("0%");
|
||||
root_child2.setHeight(30);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child0.getComputedHeight()).toBe(30);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child1_child0.getComputedLeft()).toBe(25);
|
||||
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child1_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child1_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child1_child1.getComputedLeft()).toBe(50);
|
||||
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1_child1.getComputedWidth()).toBe(25);
|
||||
expect(root_child1_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(75);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(25);
|
||||
expect(root_child2.getComputedHeight()).toBe(30);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(100);
|
||||
expect(root.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(75);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child0.getComputedHeight()).toBe(30);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(0);
|
||||
expect(root_child1.getComputedHeight()).toBe(0);
|
||||
|
||||
expect(root_child1_child0.getComputedLeft()).toBe(50);
|
||||
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child1_child0.getComputedWidth()).toBe(25);
|
||||
expect(root_child1_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child1_child1.getComputedLeft()).toBe(25);
|
||||
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1_child1.getComputedWidth()).toBe(25);
|
||||
expect(root_child1_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(25);
|
||||
expect(root_child2.getComputedHeight()).toBe(30);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<5aa80de7d8424e35b5b1b205ff44f4cc>>
|
||||
* @generated SignedSource<<285a0c9dd4b646e7b1af77658fc41d99>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexDirectionTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<fabda3f9a1c5266bab041546630406ab>>
|
||||
* @generated SignedSource<<60e19ea0b6b108cd6b0d4062c0b0316d>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<a465733b5a79e26c64aeeb431b822fee>>
|
||||
* @generated SignedSource<<5c4e3faf7c401d359b341c41a3055313>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexWrapTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<d7267afda72d6ed64f8a74487c3952d0>>
|
||||
* @generated SignedSource<<3fad56933a314f0a81b6ed504040ffae>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGGapTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
|
3165
javascript/tests/generated/YGIntrinsicSizeTest.test.ts
Normal file
3165
javascript/tests/generated/YGIntrinsicSizeTest.test.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,13 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<acccc0a7a2ba5a312dae041805512503>>
|
||||
* @generated SignedSource<<d9c3d3430edadef3cd6ba8bbacbb31a2>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGJustifyContentTest.html
|
||||
*/
|
||||
|
||||
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
|
||||
import Yoga from 'yoga-layout';
|
||||
import {
|
||||
Align,
|
||||
BoxSizing,
|
||||
Direction,
|
||||
Display,
|
||||
Edge,
|
||||
@@ -1923,7 +1925,7 @@ test('justify_content_overflow_row_space_evenly', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('justify_content_overflow_row_reverse_space_around', () => {
|
||||
test.skip('justify_content_overflow_row_reverse_space_around', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
@@ -1953,17 +1955,17 @@ test('justify_content_overflow_row_reverse_space_around', () => {
|
||||
expect(root.getComputedWidth()).toBe(102);
|
||||
expect(root.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(62);
|
||||
expect(root_child0.getComputedLeft()).toBe(80);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(40);
|
||||
expect(root_child0.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(22);
|
||||
expect(root_child1.getComputedLeft()).toBe(40);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(-18);
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(40);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
@@ -1975,17 +1977,17 @@ test('justify_content_overflow_row_reverse_space_around', () => {
|
||||
expect(root.getComputedWidth()).toBe(102);
|
||||
expect(root.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedLeft()).toBe(-18);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(40);
|
||||
expect(root_child0.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(40);
|
||||
expect(root_child1.getComputedLeft()).toBe(22);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(80);
|
||||
expect(root_child2.getComputedLeft()).toBe(62);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(40);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
@@ -1997,7 +1999,7 @@ test('justify_content_overflow_row_reverse_space_around', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('justify_content_overflow_row_reverse_space_evenly', () => {
|
||||
test.skip('justify_content_overflow_row_reverse_space_evenly', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
@@ -2027,17 +2029,17 @@ test('justify_content_overflow_row_reverse_space_evenly', () => {
|
||||
expect(root.getComputedWidth()).toBe(102);
|
||||
expect(root.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(62);
|
||||
expect(root_child0.getComputedLeft()).toBe(80);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(40);
|
||||
expect(root_child0.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(22);
|
||||
expect(root_child1.getComputedLeft()).toBe(40);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(-18);
|
||||
expect(root_child2.getComputedLeft()).toBe(0);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(40);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
@@ -2049,17 +2051,17 @@ test('justify_content_overflow_row_reverse_space_evenly', () => {
|
||||
expect(root.getComputedWidth()).toBe(102);
|
||||
expect(root.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedLeft()).toBe(-18);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(40);
|
||||
expect(root_child0.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(40);
|
||||
expect(root_child1.getComputedLeft()).toBe(22);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(40);
|
||||
expect(root_child1.getComputedHeight()).toBe(102);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(80);
|
||||
expect(root_child2.getComputedLeft()).toBe(62);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(40);
|
||||
expect(root_child2.getComputedHeight()).toBe(102);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user