Compare commits
99 Commits
v3.1.0
...
export-D80
Author | SHA1 | Date | |
---|---|---|---|
|
0ef6192b16 | ||
|
c582f7caa6 | ||
|
bf1cbd29c0 | ||
|
499a825836 | ||
|
8087edaafe | ||
|
c90aecbdfe | ||
|
c54215fd77 | ||
|
cf50bc9adf | ||
|
d1037226c0 | ||
|
714d4b2ebe | ||
|
d4b5220e6c | ||
|
da5ba7f7c6 | ||
|
8bf7a34d02 | ||
|
82671c0132 | ||
|
9f2a9476e5 | ||
|
c7c85621fc | ||
|
73980a3cf8 | ||
|
4b5ca50117 | ||
|
30291398f3 | ||
|
27d632c697 | ||
|
117fa494f7 | ||
|
073c136117 | ||
|
1232761571 | ||
|
c935fd5e10 | ||
|
624325302c | ||
|
37a94a86de | ||
|
4abc1a7d5f | ||
|
51e6095005 | ||
|
79cef614ce | ||
|
6455a848a7 | ||
|
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
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -73,3 +73,6 @@ local.properties
|
||||
|
||||
# Docusarus build
|
||||
.docusaurus
|
||||
|
||||
# Android Studio
|
||||
.idea
|
||||
|
@@ -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,9 +6,10 @@
|
||||
*/
|
||||
|
||||
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"
|
||||
id 'org.jetbrains.kotlin.android' version '2.1.20' apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -34,6 +35,8 @@ nexusPublishing {
|
||||
sonatype {
|
||||
username.set(sonatypeUsername)
|
||||
password.set(sonatypePassword)
|
||||
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
|
||||
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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>
|
||||
|
@@ -240,3 +240,14 @@
|
||||
<div style="position:relative; width:50px; height:50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_items_non_stretch_s526008"
|
||||
style="flex-direction: column; width: 400px; height: 400px;">
|
||||
<div style="flex-direction: row;">
|
||||
<div style="flex-direction: column; align-items: flex-start;">
|
||||
<div>
|
||||
<div style="width: 0; height: 10px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</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) {
|
||||
const valueStr = toValueJavascript(value);
|
||||
|
||||
if (valueStr == "'auto'") {
|
||||
this.push(
|
||||
nodeName + '.setPositionAuto(' + toValueJavascript(edge) + ');',
|
||||
);
|
||||
} else {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setPosition(' +
|
||||
toValueJavascript(edge) +
|
||||
', ' +
|
||||
toValueJavascript(value) +
|
||||
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);
|
||||
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 for ${test}`);
|
||||
console.error(`Invalid signature "${file}"`);
|
||||
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;
|
||||
}
|
||||
}
|
||||
} 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,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>%s</title>
|
||||
@@ -7,17 +8,23 @@
|
||||
<script src="gentest-cpp.js"></script>
|
||||
<script src="gentest-java.js"></script>
|
||||
<script src="gentest-javascript.js"></script>
|
||||
<script src="gentest-log.js"></script>
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Ahem';
|
||||
src: url('./fonts/Ahem.ttf') format('truetype');
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: Helvetica;
|
||||
font-size: 14px;
|
||||
font: 10px/1 Ahem;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
div, span {
|
||||
div,
|
||||
span {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border: 0 solid black;
|
||||
@@ -44,6 +51,7 @@
|
||||
position: absolute;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -67,4 +75,5 @@
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -1,17 +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.
|
||||
*/
|
||||
|
||||
// You can use this script to configure the gradleEnterprise{} block in your build.
|
||||
// You need to rename this file to ./gradle/gradle-enterprise.gradle.kts in order for
|
||||
// this to be processed.
|
||||
extensions.getByName("gradleEnterprise").withGroovyBuilder {
|
||||
setProperty("server", "https://your-gradle-enterprise-instance.example.com")
|
||||
getProperty("buildScan").withGroovyBuilder {
|
||||
"publishAlways"()
|
||||
"tag"(if(System.getenv("CI") != null) "CI" else "Local")
|
||||
}
|
||||
}
|
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,18 +133,21 @@ 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.
|
||||
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/>
|
||||
|
||||
|
@@ -9,6 +9,7 @@ plugins {
|
||||
id("com.android.library")
|
||||
id("maven-publish")
|
||||
id("signing")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
group = "com.facebook.yoga"
|
||||
@@ -21,15 +22,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") } }
|
||||
@@ -47,6 +49,8 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
kotlinOptions { jvmTarget = "1.8" }
|
||||
|
||||
publishing {
|
||||
multipleVariants {
|
||||
withSourcesJar()
|
||||
@@ -59,6 +63,7 @@ android {
|
||||
dependencies {
|
||||
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
||||
implementation("com.facebook.soloader:soloader:0.10.5")
|
||||
implementation("androidx.core:core-ktx:1.16.0")
|
||||
testImplementation("junit:junit:4.12")
|
||||
}
|
||||
|
||||
|
@@ -1,43 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public enum LayoutPassReason {
|
||||
INITIAL(0),
|
||||
ABS_LAYOUT(1),
|
||||
STRETCH(2),
|
||||
MULTILINE_STRETCH(3),
|
||||
FLEX_LAYOUT(4),
|
||||
MEASURE(5),
|
||||
ABS_MEASURE(6),
|
||||
FLEX_MEASURE(7);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
LayoutPassReason(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static LayoutPassReason fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return INITIAL;
|
||||
case 1: return ABS_LAYOUT;
|
||||
case 2: return STRETCH;
|
||||
case 3: return MULTILINE_STRETCH;
|
||||
case 4: return FLEX_LAYOUT;
|
||||
case 5: return MEASURE;
|
||||
case 6: return ABS_MEASURE;
|
||||
case 7: return FLEX_MEASURE;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
35
java/com/facebook/yoga/LayoutPassReason.kt
Normal file
35
java/com/facebook/yoga/LayoutPassReason.kt
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
public enum class LayoutPassReason(public val intValue: Int) {
|
||||
INITIAL(0),
|
||||
ABS_LAYOUT(1),
|
||||
STRETCH(2),
|
||||
MULTILINE_STRETCH(3),
|
||||
FLEX_LAYOUT(4),
|
||||
MEASURE(5),
|
||||
ABS_MEASURE(6),
|
||||
FLEX_MEASURE(7);
|
||||
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
public fun fromInt(value: Int): LayoutPassReason =
|
||||
when (value) {
|
||||
0 -> INITIAL
|
||||
1 -> ABS_LAYOUT
|
||||
2 -> STRETCH
|
||||
3 -> MULTILINE_STRETCH
|
||||
4 -> FLEX_LAYOUT
|
||||
5 -> MEASURE
|
||||
6 -> ABS_MEASURE
|
||||
7 -> FLEX_MEASURE
|
||||
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,12 +5,12 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
package com.facebook.yoga
|
||||
|
||||
public interface YogaBaselineFunction {
|
||||
public fun interface YogaBaselineFunction {
|
||||
/**
|
||||
* Return the baseline of the node in points. When no baseline function is set the baseline
|
||||
* default to the computed height of the node.
|
||||
*/
|
||||
float baseline(YogaNode node, float width, float height);
|
||||
public fun baseline(node: YogaNode, width: Float, height: Float): Float
|
||||
}
|
@@ -5,17 +5,17 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public enum YogaLayoutType {
|
||||
LAYOUT(0),
|
||||
MEASURE(1),
|
||||
CACHED_LAYOUT(2),
|
||||
CACHED_MEASURE(3);
|
||||
public enum YogaBoxSizing {
|
||||
BORDER_BOX(0),
|
||||
CONTENT_BOX(1);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
YogaLayoutType(int intValue) {
|
||||
YogaBoxSizing(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -23,12 +23,10 @@ public enum YogaLayoutType {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static YogaLayoutType fromInt(int value) {
|
||||
public static YogaBoxSizing fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return LAYOUT;
|
||||
case 1: return MEASURE;
|
||||
case 2: return CACHED_LAYOUT;
|
||||
case 3: return CACHED_MEASURE;
|
||||
case 0: return BORDER_BOX;
|
||||
case 1: return CONTENT_BOX;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
@@ -5,10 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
package com.facebook.yoga
|
||||
|
||||
public abstract class YogaConfigFactory {
|
||||
public static YogaConfig create() {
|
||||
return new YogaConfigJNIFinalizer();
|
||||
}
|
||||
public object YogaConfigFactory {
|
||||
@JvmStatic public fun create(): YogaConfig = YogaConfigJNIFinalizer()
|
||||
}
|
@@ -1,25 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public class YogaConstants {
|
||||
|
||||
public static final float UNDEFINED = Float.NaN;
|
||||
|
||||
public static boolean isUndefined(float value) {
|
||||
return Float.compare(value, UNDEFINED) == 0;
|
||||
}
|
||||
|
||||
public static boolean isUndefined(YogaValue value) {
|
||||
return value.unit == YogaUnit.UNDEFINED;
|
||||
}
|
||||
|
||||
public static float getUndefined() {
|
||||
return UNDEFINED;
|
||||
}
|
||||
}
|
18
java/com/facebook/yoga/YogaConstants.kt
Normal file
18
java/com/facebook/yoga/YogaConstants.kt
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
public object YogaConstants {
|
||||
@JvmField public val UNDEFINED: Float = Float.NaN
|
||||
|
||||
@JvmStatic public fun isUndefined(value: Float): Boolean = value.compareTo(UNDEFINED) == 0
|
||||
|
||||
@JvmStatic public fun isUndefined(value: YogaValue): Boolean = value.unit == YogaUnit.UNDEFINED
|
||||
|
||||
@JvmStatic public fun getUndefined(): Float = UNDEFINED
|
||||
}
|
@@ -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;
|
||||
|
27
java/com/facebook/yoga/YogaLayoutType.kt
Normal file
27
java/com/facebook/yoga/YogaLayoutType.kt
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
public enum class YogaLayoutType(public val intValue: Int) {
|
||||
LAYOUT(0),
|
||||
MEASURE(1),
|
||||
CACHED_LAYOUT(2),
|
||||
CACHED_MEASURE(3);
|
||||
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
public fun fromInt(value: Int): YogaLayoutType =
|
||||
when (value) {
|
||||
0 -> LAYOUT
|
||||
1 -> MEASURE
|
||||
2 -> CACHED_LAYOUT
|
||||
3 -> CACHED_MEASURE
|
||||
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,16 +5,15 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
package com.facebook.yoga
|
||||
|
||||
import com.facebook.yoga.annotations.DoNotStrip;
|
||||
import com.facebook.yoga.annotations.DoNotStrip
|
||||
|
||||
/**
|
||||
* Interface for receiving logs from native layer. Use by setting YogaNode.setLogger(myLogger);
|
||||
* See YogaLogLevel for the different log levels.
|
||||
* Interface for receiving logs from native layer. Use by setting YogaNode.setLogger(myLogger); See
|
||||
* YogaLogLevel for the different log levels.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public interface YogaLogger {
|
||||
@DoNotStrip
|
||||
void log(YogaLogLevel level, String message);
|
||||
public fun interface YogaLogger {
|
||||
@DoNotStrip public fun log(level: YogaLogLevel, message: String)
|
||||
}
|
@@ -1,20 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public interface YogaMeasureFunction {
|
||||
/**
|
||||
* Return a value created by YogaMeasureOutput.make(width, height);
|
||||
*/
|
||||
long measure(
|
||||
YogaNode node,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode);
|
||||
}
|
19
java/com/facebook/yoga/YogaMeasureFunction.kt
Normal file
19
java/com/facebook/yoga/YogaMeasureFunction.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
public fun interface YogaMeasureFunction {
|
||||
/** Return a value created by YogaMeasureOutput.make(width, height); */
|
||||
public fun measure(
|
||||
node: YogaNode,
|
||||
width: Float,
|
||||
widthMode: YogaMeasureMode,
|
||||
height: Float,
|
||||
heightMode: YogaMeasureMode
|
||||
): Long
|
||||
}
|
@@ -1,32 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
/**
|
||||
* Helpers for building measure output value.
|
||||
*/
|
||||
public class YogaMeasureOutput {
|
||||
|
||||
public static long make(float width, float height) {
|
||||
final int wBits = Float.floatToRawIntBits(width);
|
||||
final int hBits = Float.floatToRawIntBits(height);
|
||||
return ((long) wBits) << 32 | ((long) hBits);
|
||||
}
|
||||
|
||||
public static long make(int width, int height) {
|
||||
return make((float) width, (float) height);
|
||||
}
|
||||
|
||||
public static float getWidth(long measureOutput) {
|
||||
return Float.intBitsToFloat((int) (0xFFFFFFFF & (measureOutput >> 32)));
|
||||
}
|
||||
|
||||
public static float getHeight(long measureOutput) {
|
||||
return Float.intBitsToFloat((int) (0xFFFFFFFF & measureOutput));
|
||||
}
|
||||
}
|
29
java/com/facebook/yoga/YogaMeasureOutput.kt
Normal file
29
java/com/facebook/yoga/YogaMeasureOutput.kt
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
/** Helpers for building measure output value. */
|
||||
public object YogaMeasureOutput {
|
||||
@JvmStatic
|
||||
public fun make(width: Float, height: Float): Long {
|
||||
val wBits = java.lang.Float.floatToRawIntBits(width)
|
||||
val hBits = java.lang.Float.floatToRawIntBits(height)
|
||||
return (wBits.toLong()) shl 32 or (hBits.toLong())
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun make(width: Int, height: Int): Long = make(width.toFloat(), height.toFloat())
|
||||
|
||||
@JvmStatic
|
||||
public fun getWidth(measureOutput: Long): Float =
|
||||
java.lang.Float.intBitsToFloat((0xFFFFFFFFL and (measureOutput shr 32)).toInt())
|
||||
|
||||
@JvmStatic
|
||||
public fun getHeight(measureOutput: Long): Float =
|
||||
java.lang.Float.intBitsToFloat((0xFFFFFFFFL and measureOutput).toInt())
|
||||
}
|
@@ -1,117 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.yoga.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaNative {
|
||||
static {
|
||||
SoLoader.loadLibrary("yoga");
|
||||
}
|
||||
|
||||
// JNI methods that use Vanilla JNI
|
||||
// YGConfig related
|
||||
static native long jni_YGConfigNewJNI();
|
||||
static native void jni_YGConfigFreeJNI(long nativePointer);
|
||||
static native void jni_YGConfigSetExperimentalFeatureEnabledJNI(long nativePointer, int feature, boolean enabled);
|
||||
static native void jni_YGConfigSetUseWebDefaultsJNI(long nativePointer, boolean useWebDefaults);
|
||||
static native void jni_YGConfigSetPointScaleFactorJNI(long nativePointer, float pixelsInPoint);
|
||||
static native void jni_YGConfigSetErrataJNI(long nativePointer, int errata);
|
||||
static native int jni_YGConfigGetErrataJNI(long nativePointer);
|
||||
static native void jni_YGConfigSetLoggerJNI(long nativePointer, YogaLogger logger);
|
||||
|
||||
// YGNode related
|
||||
static native long jni_YGNodeNewJNI();
|
||||
static native long jni_YGNodeNewWithConfigJNI(long configPointer);
|
||||
static native void jni_YGNodeFinalizeJNI(long nativePointer);
|
||||
static native void jni_YGNodeResetJNI(long nativePointer);
|
||||
static native void jni_YGNodeInsertChildJNI(long nativePointer, long childPointer, int index);
|
||||
static native void jni_YGNodeSwapChildJNI(long nativePointer, long childPointer, int index);
|
||||
static native void jni_YGNodeSetIsReferenceBaselineJNI(long nativePointer, boolean isReferenceBaseline);
|
||||
static native boolean jni_YGNodeIsReferenceBaselineJNI(long nativePointer);
|
||||
static native void jni_YGNodeRemoveAllChildrenJNI(long nativePointer);
|
||||
static native void jni_YGNodeRemoveChildJNI(long nativePointer, long childPointer);
|
||||
static native void jni_YGNodeCalculateLayoutJNI(long nativePointer, float width, float height, long[] nativePointers, YogaNodeJNIBase[] nodes);
|
||||
static native void jni_YGNodeMarkDirtyJNI(long nativePointer);
|
||||
static native boolean jni_YGNodeIsDirtyJNI(long nativePointer);
|
||||
static native void jni_YGNodeCopyStyleJNI(long dstNativePointer, long srcNativePointer);
|
||||
static native int jni_YGNodeStyleGetDirectionJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetDirectionJNI(long nativePointer, int direction);
|
||||
static native int jni_YGNodeStyleGetFlexDirectionJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexDirectionJNI(long nativePointer, int flexDirection);
|
||||
static native int jni_YGNodeStyleGetJustifyContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetJustifyContentJNI(long nativePointer, int justifyContent);
|
||||
static native int jni_YGNodeStyleGetAlignItemsJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAlignItemsJNI(long nativePointer, int alignItems);
|
||||
static native int jni_YGNodeStyleGetAlignSelfJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAlignSelfJNI(long nativePointer, int alignSelf);
|
||||
static native int jni_YGNodeStyleGetAlignContentJNI(long nativePointer);
|
||||
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_YGNodeStyleGetFlexWrapJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexWrapJNI(long nativePointer, int wrapType);
|
||||
static native int jni_YGNodeStyleGetOverflowJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetOverflowJNI(long nativePointer, int overflow);
|
||||
static native int jni_YGNodeStyleGetDisplayJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetDisplayJNI(long nativePointer, int display);
|
||||
static native float jni_YGNodeStyleGetFlexJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexJNI(long nativePointer, float flex);
|
||||
static native float jni_YGNodeStyleGetFlexGrowJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexGrowJNI(long nativePointer, float flexGrow);
|
||||
static native float jni_YGNodeStyleGetFlexShrinkJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexShrinkJNI(long nativePointer, float flexShrink);
|
||||
static native long jni_YGNodeStyleGetFlexBasisJNI(long nativePointer);
|
||||
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 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);
|
||||
static native void jni_YGNodeStyleSetMarginAutoJNI(long nativePointer, int edge);
|
||||
static native long jni_YGNodeStyleGetPaddingJNI(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetPaddingJNI(long nativePointer, int edge, float padding);
|
||||
static native void jni_YGNodeStyleSetPaddingPercentJNI(long nativePointer, int edge, float percent);
|
||||
static native float jni_YGNodeStyleGetBorderJNI(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetBorderJNI(long nativePointer, int edge, float border);
|
||||
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 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 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 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 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 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 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 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 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);
|
||||
static native void jni_YGNodeSetHasBaselineFuncJNI(long nativePointer, boolean hasMeasureFunc);
|
||||
static native void jni_YGNodeSetStyleInputsJNI(long nativePointer, float[] styleInputsArray, int size);
|
||||
static native long jni_YGNodeCloneJNI(long nativePointer);
|
||||
static native void jni_YGNodeSetAlwaysFormsContainingBlockJNI(long nativePointer, boolean alwaysFormContainingBlock);
|
||||
}
|
331
java/com/facebook/yoga/YogaNative.kt
Normal file
331
java/com/facebook/yoga/YogaNative.kt
Normal file
@@ -0,0 +1,331 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
import com.facebook.soloader.SoLoader
|
||||
import com.facebook.yoga.annotations.DoNotStrip
|
||||
|
||||
@DoNotStrip
|
||||
public object YogaNative {
|
||||
init {
|
||||
SoLoader.loadLibrary("yoga")
|
||||
}
|
||||
|
||||
// JNI methods that use Vanilla JNI
|
||||
// YGConfig related
|
||||
@JvmStatic public external fun jni_YGConfigNewJNI(): Long
|
||||
|
||||
@JvmStatic public external fun jni_YGConfigFreeJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGConfigSetExperimentalFeatureEnabledJNI(
|
||||
nativePointer: Long,
|
||||
feature: Int,
|
||||
enabled: Boolean
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGConfigSetUseWebDefaultsJNI(nativePointer: Long, useWebDefaults: Boolean)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGConfigSetPointScaleFactorJNI(nativePointer: Long, pixelsInPoint: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGConfigSetErrataJNI(nativePointer: Long, errata: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGConfigGetErrataJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic public external fun jni_YGConfigSetLoggerJNI(nativePointer: Long, logger: YogaLogger)
|
||||
|
||||
// YGNode related
|
||||
@JvmStatic public external fun jni_YGNodeNewJNI(): Long
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeNewWithConfigJNI(configPointer: Long): Long
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeFinalizeJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeResetJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeInsertChildJNI(nativePointer: Long, childPointer: Long, index: Int)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeSwapChildJNI(nativePointer: Long, childPointer: Long, index: Int)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeSetIsReferenceBaselineJNI(
|
||||
nativePointer: Long,
|
||||
isReferenceBaseline: Boolean
|
||||
)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeIsReferenceBaselineJNI(nativePointer: Long): Boolean
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeRemoveAllChildrenJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeRemoveChildJNI(nativePointer: Long, childPointer: Long)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeCalculateLayoutJNI(
|
||||
nativePointer: Long,
|
||||
width: Float,
|
||||
height: Float,
|
||||
nativePointers: LongArray,
|
||||
nodes: Array<YogaNodeJNIBase>
|
||||
)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeMarkDirtyJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeIsDirtyJNI(nativePointer: Long): Boolean
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeCopyStyleJNI(dstNativePointer: Long, srcNativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetDirectionJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetDirectionJNI(nativePointer: Long, direction: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetFlexDirectionJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetFlexDirectionJNI(nativePointer: Long, flexDirection: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetJustifyContentJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetJustifyContentJNI(nativePointer: Long, justifyContent: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetAlignItemsJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetAlignItemsJNI(nativePointer: Long, alignItems: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetAlignSelfJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetAlignSelfJNI(nativePointer: Long, alignSelf: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetAlignContentJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetAlignContentJNI(nativePointer: Long, alignContent: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetPositionTypeJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetPositionTypeJNI(nativePointer: Long, positionType: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetBoxSizingJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetBoxSizingJNI(nativePointer: Long, boxSizing: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetFlexWrapJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetFlexWrapJNI(nativePointer: Long, wrapType: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetOverflowJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetOverflowJNI(nativePointer: Long, overflow: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetDisplayJNI(nativePointer: Long): Int
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetDisplayJNI(nativePointer: Long, display: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetFlexJNI(nativePointer: Long): Float
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetFlexJNI(nativePointer: Long, flex: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetFlexGrowJNI(nativePointer: Long): Float
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetFlexGrowJNI(nativePointer: Long, flexGrow: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetFlexShrinkJNI(nativePointer: Long): Float
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetFlexShrinkJNI(nativePointer: Long, flexShrink: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetFlexBasisJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetFlexBasisJNI(nativePointer: Long, flexBasis: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetFlexBasisPercentJNI(nativePointer: Long, percent: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisAutoJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisMaxContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisFitContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisStretchJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetMarginJNI(nativePointer: Long, edge: Int): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMarginJNI(nativePointer: Long, edge: Int, margin: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMarginPercentJNI(
|
||||
nativePointer: Long,
|
||||
edge: Int,
|
||||
percent: Float
|
||||
)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMarginAutoJNI(nativePointer: Long, edge: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetPaddingJNI(nativePointer: Long, edge: Int): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetPaddingJNI(nativePointer: Long, edge: Int, padding: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetPaddingPercentJNI(
|
||||
nativePointer: Long,
|
||||
edge: Int,
|
||||
percent: Float
|
||||
)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetBorderJNI(nativePointer: Long, edge: Int): Float
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetBorderJNI(nativePointer: Long, edge: Int, border: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetPositionJNI(nativePointer: Long, edge: Int): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetPositionJNI(nativePointer: Long, edge: Int, position: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetPositionPercentJNI(
|
||||
nativePointer: Long,
|
||||
edge: Int,
|
||||
percent: Float
|
||||
)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetPositionAutoJNI(nativePointer: Long, edge: Int)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetWidthJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetWidthJNI(nativePointer: Long, width: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetWidthPercentJNI(nativePointer: Long, percent: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetWidthAutoJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetWidthMaxContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetWidthFitContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetWidthStretchJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetHeightJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetHeightJNI(nativePointer: Long, height: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetHeightPercentJNI(nativePointer: Long, percent: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetHeightAutoJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetHeightMaxContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetHeightFitContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetHeightStretchJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetMinWidthJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthJNI(nativePointer: Long, minWidth: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMinWidthPercentJNI(nativePointer: Long, percent: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthMaxContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthFitContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthStretchJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetMinHeightJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMinHeightJNI(nativePointer: Long, minHeight: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMinHeightPercentJNI(nativePointer: Long, percent: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMinHeightMaxContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMinHeightFitContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMinHeightStretchJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetMaxWidthJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthJNI(nativePointer: Long, maxWidth: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMaxWidthPercentJNI(nativePointer: Long, percent: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthMaxContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthFitContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthStretchJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetMaxHeightJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMaxHeightJNI(nativePointer: Long, maxheight: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetMaxHeightPercentJNI(nativePointer: Long, percent: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMaxHeightMaxContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMaxHeightFitContentJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleSetMaxHeightStretchJNI(nativePointer: Long)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetAspectRatioJNI(nativePointer: Long): Float
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetAspectRatioJNI(nativePointer: Long, aspectRatio: Float)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeStyleGetGapJNI(nativePointer: Long, gutter: Int): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetGapJNI(nativePointer: Long, gutter: Int, gapLength: Float)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeStyleSetGapPercentJNI(
|
||||
nativePointer: Long,
|
||||
gutter: Int,
|
||||
gapLength: Float
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeSetHasMeasureFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeSetHasBaselineFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeSetStyleInputsJNI(
|
||||
nativePointer: Long,
|
||||
styleInputsArray: FloatArray,
|
||||
size: Int
|
||||
)
|
||||
|
||||
@JvmStatic public external fun jni_YGNodeCloneJNI(nativePointer: Long): Long
|
||||
|
||||
@JvmStatic
|
||||
public external fun jni_YGNodeSetAlwaysFormsContainingBlockJNI(
|
||||
nativePointer: Long,
|
||||
alwaysFormContainingBlock: Boolean
|
||||
)
|
||||
}
|
@@ -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);
|
||||
|
||||
|
@@ -1,18 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public abstract class YogaNodeFactory {
|
||||
public static YogaNode create() {
|
||||
return new YogaNodeJNIFinalizer();
|
||||
}
|
||||
|
||||
public static YogaNode create(YogaConfig config) {
|
||||
return new YogaNodeJNIFinalizer(config);
|
||||
}
|
||||
}
|
14
java/com/facebook/yoga/YogaNodeFactory.kt
Normal file
14
java/com/facebook/yoga/YogaNodeFactory.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
public object YogaNodeFactory {
|
||||
@JvmStatic public fun create(): YogaNode = YogaNodeJNIFinalizer()
|
||||
|
||||
@JvmStatic public fun create(config: YogaConfig): YogaNode = YogaNodeJNIFinalizer(config)
|
||||
}
|
@@ -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();
|
||||
}
|
||||
|
@@ -1,51 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public class YogaStyleInputs {
|
||||
public static final short LAYOUT_DIRECTION = 0;
|
||||
public static final short FLEX_DIRECTION = 1;
|
||||
public static final short FLEX = 2;
|
||||
public static final short FLEX_GROW = 3;
|
||||
public static final short FLEX_SHRINK = 4;
|
||||
public static final short FLEX_BASIS = 5;
|
||||
public static final short FLEX_BASIS_PERCENT = 6;
|
||||
public static final short FLEX_BASIS_AUTO = 7;
|
||||
public static final short FLEX_WRAP = 8;
|
||||
public static final short WIDTH = 9;
|
||||
public static final short WIDTH_PERCENT = 10;
|
||||
public static final short WIDTH_AUTO = 11;
|
||||
public static final short MIN_WIDTH = 12;
|
||||
public static final short MIN_WIDTH_PERCENT = 13;
|
||||
public static final short MAX_WIDTH = 14;
|
||||
public static final short MAX_WIDTH_PERCENT = 15;
|
||||
public static final short HEIGHT = 16;
|
||||
public static final short HEIGHT_PERCENT = 17;
|
||||
public static final short HEIGHT_AUTO = 18;
|
||||
public static final short MIN_HEIGHT = 19;
|
||||
public static final short MIN_HEIGHT_PERCENT = 20;
|
||||
public static final short MAX_HEIGHT = 21;
|
||||
public static final short MAX_HEIGHT_PERCENT = 22;
|
||||
public static final short JUSTIFY_CONTENT = 23;
|
||||
public static final short ALIGN_ITEMS = 24;
|
||||
public static final short ALIGN_SELF = 25;
|
||||
public static final short ALIGN_CONTENT = 26;
|
||||
public static final short POSITION_TYPE = 27;
|
||||
public static final short ASPECT_RATIO = 28;
|
||||
public static final short OVERFLOW = 29;
|
||||
public static final short DISPLAY = 30;
|
||||
public static final short MARGIN = 31;
|
||||
public static final short MARGIN_PERCENT = 32;
|
||||
public static final short MARGIN_AUTO = 33;
|
||||
public static final short PADDING = 34;
|
||||
public static final short PADDING_PERCENT = 35;
|
||||
public static final short BORDER = 36;
|
||||
public static final short POSITION = 37;
|
||||
public static final short POSITION_PERCENT = 38;
|
||||
public static final short IS_REFERENCE_BASELINE = 39;
|
||||
}
|
51
java/com/facebook/yoga/YogaStyleInputs.kt
Normal file
51
java/com/facebook/yoga/YogaStyleInputs.kt
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
public object YogaStyleInputs {
|
||||
public const val LAYOUT_DIRECTION: Short = 0
|
||||
public const val FLEX_DIRECTION: Short = 1
|
||||
public const val FLEX: Short = 2
|
||||
public const val FLEX_GROW: Short = 3
|
||||
public const val FLEX_SHRINK: Short = 4
|
||||
public const val FLEX_BASIS: Short = 5
|
||||
public const val FLEX_BASIS_PERCENT: Short = 6
|
||||
public const val FLEX_BASIS_AUTO: Short = 7
|
||||
public const val FLEX_WRAP: Short = 8
|
||||
public const val WIDTH: Short = 9
|
||||
public const val WIDTH_PERCENT: Short = 10
|
||||
public const val WIDTH_AUTO: Short = 11
|
||||
public const val MIN_WIDTH: Short = 12
|
||||
public const val MIN_WIDTH_PERCENT: Short = 13
|
||||
public const val MAX_WIDTH: Short = 14
|
||||
public const val MAX_WIDTH_PERCENT: Short = 15
|
||||
public const val HEIGHT: Short = 16
|
||||
public const val HEIGHT_PERCENT: Short = 17
|
||||
public const val HEIGHT_AUTO: Short = 18
|
||||
public const val MIN_HEIGHT: Short = 19
|
||||
public const val MIN_HEIGHT_PERCENT: Short = 20
|
||||
public const val MAX_HEIGHT: Short = 21
|
||||
public const val MAX_HEIGHT_PERCENT: Short = 22
|
||||
public const val JUSTIFY_CONTENT: Short = 23
|
||||
public const val ALIGN_ITEMS: Short = 24
|
||||
public const val ALIGN_SELF: Short = 25
|
||||
public const val ALIGN_CONTENT: Short = 26
|
||||
public const val POSITION_TYPE: Short = 27
|
||||
public const val ASPECT_RATIO: Short = 28
|
||||
public const val OVERFLOW: Short = 29
|
||||
public const val DISPLAY: Short = 30
|
||||
public const val MARGIN: Short = 31
|
||||
public const val MARGIN_PERCENT: Short = 32
|
||||
public const val MARGIN_AUTO: Short = 33
|
||||
public const val PADDING: Short = 34
|
||||
public const val PADDING_PERCENT: Short = 35
|
||||
public const val BORDER: Short = 36
|
||||
public const val POSITION: Short = 37
|
||||
public const val POSITION_PERCENT: Short = 38
|
||||
public const val IS_REFERENCE_BASELINE: Short = 39
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -1,18 +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.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
||||
|
||||
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR })
|
||||
@Retention(CLASS)
|
||||
public @interface DoNotStrip { }
|
19
java/com/facebook/yoga/annotations/DoNotStrip.kt
Normal file
19
java/com/facebook/yoga/annotations/DoNotStrip.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.annotations
|
||||
|
||||
@Target(
|
||||
AnnotationTarget.CLASS,
|
||||
AnnotationTarget.FIELD,
|
||||
AnnotationTarget.FUNCTION,
|
||||
AnnotationTarget.PROPERTY_GETTER,
|
||||
AnnotationTarget.PROPERTY_SETTER,
|
||||
AnnotationTarget.CONSTRUCTOR,
|
||||
)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
public annotation class DoNotStrip
|
@@ -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<<84597dd8b2c4f3aac1f21abe68f25308>>
|
||||
* 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 {
|
||||
@@ -2292,6 +2293,86 @@ public class YGAlignItemsTest {
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_items_non_stretch_s526008() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(400f);
|
||||
root.setHeight(400f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setAlignItems(YogaAlign.FLEX_START);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0 = createNode(config);
|
||||
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0_child0 = createNode(config);
|
||||
root_child0_child0_child0_child0.setHeight(10f);
|
||||
root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(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(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, 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(0f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(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(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(400f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, 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(0f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0_child0_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<<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');
|
||||
|
||||
|
@@ -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)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user