Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
69b8934429 |
23
.github/actions/clang-format/action.yml
vendored
Normal file
23
.github/actions/clang-format/action.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
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,7 +16,6 @@ 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: 20.x
|
||||
node-version: 18.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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: 'snapshot-artifacts'
|
||||
path: '~/.m2/repository/'
|
||||
|
10
.github/workflows/validate-cpp.yml
vendored
10
.github/workflows/validate-cpp.yml
vendored
@@ -97,3 +97,13 @@ 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@v4
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: npm-package
|
||||
path: javascript/yoga-layout.tar.gz
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -73,6 +73,3 @@ local.properties
|
||||
|
||||
# Docusarus build
|
||||
.docusaurus
|
||||
|
||||
# Android Studio
|
||||
.idea
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Yoga [](http://cocoapods.org/pods/Yoga) [](https://www.npmjs.com/package/yoga-layout) [](https://search.maven.org/artifact/com.facebook.yoga/yoga) 
|
||||
# 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 is an embeddable and performant flexbox layout engine with bindings for multiple languages.
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'Yoga'
|
||||
spec.version = '0.0.0'
|
||||
spec.version = '3.1.0'
|
||||
spec.license = { :type => 'MIT', :file => "LICENSE" }
|
||||
spec.homepage = 'https://yogalayout.dev/'
|
||||
spec.documentation_url = 'https://yogalayout.dev/docs'
|
||||
|
@@ -6,10 +6,9 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("com.android.library") version "8.7.1" apply false
|
||||
id("com.android.application") version "8.7.1" apply false
|
||||
id("com.android.library") version "8.2.1" apply false
|
||||
id("com.android.application") version "8.2.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 {
|
||||
@@ -35,8 +34,6 @@ 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());
|
||||
|
||||
appendYGValueIfNotDefault(
|
||||
appendFloatIfNotDefault(
|
||||
j["style"],
|
||||
"gap",
|
||||
YGNodeStyleGetGap(node, YGGutterAll),
|
||||
YGNodeStyleGetGap(defaultNode.get(), YGGutterAll));
|
||||
appendYGValueIfNotDefault(
|
||||
appendFloatIfNotDefault(
|
||||
j["style"],
|
||||
"column-gap",
|
||||
YGNodeStyleGetGap(node, YGGutterColumn),
|
||||
YGNodeStyleGetGap(defaultNode.get(), YGGutterColumn));
|
||||
appendYGValueIfNotDefault(
|
||||
appendFloatIfNotDefault(
|
||||
j["style"],
|
||||
"row-gap",
|
||||
YGNodeStyleGetGap(node, YGGutterRow),
|
||||
|
@@ -19,8 +19,8 @@ add_compile_options(
|
||||
# Enable warnings and warnings as errors
|
||||
/W4
|
||||
/WX
|
||||
# Enable RTTI
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/GR>
|
||||
# Disable 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
|
||||
# Enable RTTI
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-frtti>
|
||||
# Disable RTTI
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
||||
# Use -O2 (prioritize speed)
|
||||
$<$<CONFIG:RELEASE>:-O2>
|
||||
# Enable separate sections per function/data item
|
||||
|
21
enums.py
21
enums.py
@@ -4,19 +4,12 @@
|
||||
# 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",
|
||||
"MaxContent",
|
||||
"FitContent",
|
||||
"Stretch",
|
||||
],
|
||||
"Unit": ["Undefined", "Point", "Percent", "Auto"],
|
||||
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
|
||||
"Justify": [
|
||||
"FlexStart",
|
||||
@@ -39,9 +32,8 @@ ENUMS = {
|
||||
"SpaceEvenly",
|
||||
],
|
||||
"PositionType": ["Static", "Relative", "Absolute"],
|
||||
"Display": ["Flex", "None", "Contents"],
|
||||
"Display": ["Flex", "None"],
|
||||
"Wrap": ["NoWrap", "Wrap", "WrapReverse"],
|
||||
"BoxSizing": ["BorderBox", "ContentBox"],
|
||||
"MeasureMode": ["Undefined", "Exactly", "AtMost"],
|
||||
"Dimension": ["Width", "Height"],
|
||||
"Edge": [
|
||||
@@ -69,10 +61,9 @@ ENUMS = {
|
||||
# Allows main-axis flex basis to be stretched without flexGrow being
|
||||
# set (previously referred to as "UseLegacyStretchBehaviour")
|
||||
("StretchFlexBasis", 1 << 0),
|
||||
# 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),
|
||||
# Positioning of absolute nodes will have various bugs related to
|
||||
# justification, alignment, and insets
|
||||
("AbsolutePositioningIncorrect", 1 << 1),
|
||||
# Absolute nodes will resolve percentages against the inner size of
|
||||
# their containing node, not the padding box
|
||||
("AbsolutePercentAgainstInnerSize", 1 << 2),
|
||||
|
@@ -2,18 +2,6 @@
|
||||
<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,32 +448,3 @@
|
||||
</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,14 +240,3 @@
|
||||
<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>
|
||||
|
@@ -2,10 +2,10 @@
|
||||
<div id="aspect_ratio_does_not_stretch_cross_axis_dim" data-disabled="true" style="width: 300px; height: 300px;">
|
||||
<div style="flex: 1; overflow: scroll;">
|
||||
<div style="flex-direction: row;">
|
||||
<div style="flex: 2; aspect-ratio: 1;"></div>
|
||||
<div style="width: 5px"></div>
|
||||
<div style="flex: 1">
|
||||
<div style="flex: 1; aspect-ratio: 1;">
|
||||
<div style="flex: 2; aspect-ratio: 1;"></div>
|
||||
<div style="width: 5px"></div>
|
||||
<div style="flex: 1">
|
||||
<div style="flex: 1; aspect-ratio: 1;">
|
||||
<div style="width: 5px"></div>
|
||||
<div style="flex: 1; aspect-ratio: 1;"></div>
|
||||
</div>
|
||||
@@ -13,7 +13,3 @@
|
||||
</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>
|
||||
|
@@ -1,25 +0,0 @@
|
||||
<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>
|
@@ -1,252 +0,0 @@
|
||||
<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,61 +29,3 @@
|
||||
<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>
|
@@ -1,568 +0,0 @@
|
||||
<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,15 +157,13 @@
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<!-- 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 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>
|
||||
|
||||
<!-- 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 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,20 +693,3 @@
|
||||
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>
|
||||
|
Binary file not shown.
@@ -12,44 +12,15 @@ function toValueCpp(value) {
|
||||
return n + (Number(n) == n && n % 1 !== 0 ? 'f' : '');
|
||||
}
|
||||
|
||||
function toFunctionNameCpp(value) {
|
||||
function toFunctionName(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', ' ');
|
||||
};
|
||||
@@ -59,12 +30,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitPrologue: {
|
||||
value: function () {
|
||||
this.push([
|
||||
'#include <gtest/gtest.h>',
|
||||
'#include <yoga/Yoga.h>',
|
||||
'#include "../util/TestUtil.h"',
|
||||
'',
|
||||
]);
|
||||
this.push(['#include <gtest/gtest.h>', '#include <yoga/Yoga.h>', '']);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -78,7 +44,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push('');
|
||||
}
|
||||
|
||||
this.push('YGConfigRef config = YGConfigNew();');
|
||||
this.push('const YGConfigRef config = YGConfigNew();');
|
||||
for (const i in experiments) {
|
||||
this.push(
|
||||
'YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' +
|
||||
@@ -92,7 +58,9 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitTestTreePrologue: {
|
||||
value: function (nodeName) {
|
||||
this.push('YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);');
|
||||
this.push(
|
||||
'const YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -165,20 +133,12 @@ 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(
|
||||
@@ -265,7 +225,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetAspectRatio' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -307,7 +267,15 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetFlexBasis: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetFlexBasis', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetFlexBasis' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -351,6 +319,20 @@ 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(
|
||||
@@ -373,7 +355,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
}
|
||||
this.push(
|
||||
'YGNodeStyleSetMargin' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -384,39 +366,59 @@ 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(keywordFunctionCpp('YGNodeStyleSetMaxHeight', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMaxHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMaxWidth', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMaxWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinHeight', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMinHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinWidth', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMinWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -432,7 +434,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
value: function (nodeName, edge, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetPadding' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -446,20 +448,15 @@ 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' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
edge +
|
||||
valueStr +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
@@ -477,11 +474,25 @@ 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' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -492,21 +503,4 @@ 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,21 +100,15 @@ for (const fileName of fixtures) {
|
||||
await driver.get('file://' + process.cwd() + '/test.html');
|
||||
const logs = await driver.manage().logs().get(logging.Type.BROWSER);
|
||||
|
||||
const testLogs = logs.filter(
|
||||
log => !log.message.replace(/^[^"]*/, '').startsWith('"gentest-log:'),
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/tests/generated/${fileNameNoExtension}.cpp`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(testLogs[0].message.replace(/^[^"]*/, '')),
|
||||
),
|
||||
addSignatureToSourceCode(JSON.parse(logs[0].message.replace(/^[^"]*/, ''))),
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/java/tests/generated/com/facebook/yoga/${fileNameNoExtension}.java`,
|
||||
`${yogaDir}/java/tests/com/facebook/yoga/${fileNameNoExtension}.java`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(testLogs[1].message.replace(/^[^"]*/, '')).replace(
|
||||
JSON.parse(logs[1].message.replace(/^[^"]*/, '')).replace(
|
||||
'YogaTest',
|
||||
fileNameNoExtension,
|
||||
),
|
||||
@@ -124,7 +118,7 @@ for (const fileName of fixtures) {
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/javascript/tests/generated/${fileNameNoExtension}.test.ts`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(testLogs[2].message.replace(/^[^"]*/, '')).replace(
|
||||
JSON.parse(logs[2].message.replace(/^[^"]*/, '')).replace(
|
||||
'YogaTest',
|
||||
fileNameNoExtension,
|
||||
),
|
||||
|
@@ -17,38 +17,10 @@ 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', ' ');
|
||||
};
|
||||
@@ -83,7 +55,6 @@ 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 {',
|
||||
@@ -206,20 +177,12 @@ 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 + ');');
|
||||
@@ -306,7 +269,14 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetFlexBasis: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setFlexBasis', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setFlexBasis' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -334,6 +304,19 @@ 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) + ');');
|
||||
@@ -361,39 +344,55 @@ 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(keywordMethod('setMaxHeight', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMaxHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setMaxWidth', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMaxWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setMinHeight', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMinHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setMinWidth', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMinWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -420,21 +419,15 @@ 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 +
|
||||
valueStr +
|
||||
');',
|
||||
', ' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -445,6 +438,19 @@ 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(
|
||||
@@ -459,19 +465,4 @@ 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,9 +15,6 @@ 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;
|
||||
}
|
||||
|
||||
@@ -26,14 +23,10 @@ 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,');
|
||||
@@ -174,14 +167,6 @@ 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) {
|
||||
@@ -376,22 +361,14 @@ 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) +
|
||||
', ' +
|
||||
valueStr +
|
||||
');',
|
||||
);
|
||||
}
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setPosition(' +
|
||||
toValueJavascript(edge) +
|
||||
', ' +
|
||||
toValueJavascript(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -421,20 +398,4 @@ 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,
|
||||
)}}));`,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@@ -1,11 +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.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function gentestLog(message) {
|
||||
console.log('gentest-log: ', message);
|
||||
}
|
@@ -11,33 +11,30 @@ import * as fs from 'node:fs/promises';
|
||||
import {dirname} from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
import signedsource from 'signedsource';
|
||||
import {glob} from 'glob';
|
||||
|
||||
const yogaRootDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
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 filesToValidate = await glob(
|
||||
[
|
||||
'tests/generated/**/*.{h,cpp}',
|
||||
'javascript/tests/generated/**/*.test.ts',
|
||||
'java/tests/generated/com/facebook/yoga/**/*.java',
|
||||
],
|
||||
{
|
||||
cwd: yogaRootDir,
|
||||
},
|
||||
);
|
||||
for (const testDir of testDirs) {
|
||||
const tests = await fs.readdir(testDir);
|
||||
|
||||
console.log(`Found ${filesToValidate.length} files to validate`);
|
||||
|
||||
for (const file of filesToValidate) {
|
||||
const content = await fs.readFile(`${yogaRootDir}/${file}`, 'utf8');
|
||||
if (signedsource.isSigned(content)) {
|
||||
console.log(`Checking ${file}`);
|
||||
const validSignature = signedsource.verifySignature(content);
|
||||
if (!validSignature) {
|
||||
console.error(`Invalid signature "${file}"`);
|
||||
process.exitCode = 1;
|
||||
for (const test of tests) {
|
||||
const testData = await fs.readFile(`${testDir}/${test}`, 'utf8');
|
||||
try {
|
||||
const validSignature = signedsource.verifySignature(testData);
|
||||
if (!validSignature) {
|
||||
console.error(`Invalid signature for ${test}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
} catch (e) {
|
||||
// Java test dir does not separate generated tests from non-generated ones
|
||||
if (testDir != javaTestDir) {
|
||||
console.error(`${test}: ${e}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(`Skipped ${file}`);
|
||||
}
|
||||
}
|
||||
|
@@ -175,7 +175,6 @@ 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),
|
||||
@@ -194,6 +193,7 @@ function setupTestTree(
|
||||
index,
|
||||
) {
|
||||
e.emitTestTreePrologue(nodeName);
|
||||
|
||||
for (const style in node.style) {
|
||||
// Skip position info for root as it messes up tests
|
||||
if (
|
||||
@@ -207,6 +207,7 @@ function setupTestTree(
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isDefaultStyleValue(style, node.style[style])) {
|
||||
switch (style) {
|
||||
case 'aspect-ratio':
|
||||
@@ -519,11 +520,6 @@ function setupTestTree(
|
||||
case 'display':
|
||||
e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style]));
|
||||
break;
|
||||
case 'box-sizing':
|
||||
e.YGNodeStyleSetBoxSizing(
|
||||
nodeName,
|
||||
boxSizingValue(e, node.style[style]),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -532,14 +528,6 @@ 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;
|
||||
@@ -658,13 +646,6 @@ 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;
|
||||
}
|
||||
@@ -676,17 +657,6 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,7 +723,6 @@ function calculateTree(root, parentOffsetLeft, parentOffsetTop) {
|
||||
? child.dataset.experiments.split(' ')
|
||||
: [],
|
||||
disabled: child.dataset.disabled === 'true',
|
||||
innerText: child.innerText,
|
||||
};
|
||||
|
||||
const size = getRoundedSize(child);
|
||||
@@ -808,7 +777,6 @@ 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 --disable-warning=ExperimentalWarning --loader=babel-register-esm ./gentest-driver.ts",
|
||||
"gentest-validate": "node --disable-warning=ExperimentalWarning --loader=babel-register-esm ./gentest-validate.ts"
|
||||
"gentest": "node --loader=babel-register-esm ./gentest-driver.ts",
|
||||
"gentest-validate": "node --loader=babel-register-esm ./gentest-validate.ts"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
@@ -19,7 +19,6 @@
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^20.10.3",
|
||||
"@types/selenium-webdriver": "^4.1.21",
|
||||
"babel-register-esm": "^1.2.5",
|
||||
"glob": "^10.4.2"
|
||||
"babel-register-esm": "^1.2.5"
|
||||
}
|
||||
}
|
||||
|
@@ -1,79 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>%s</title>
|
||||
<script src="gentest.js"></script>
|
||||
<script src="gentest-cpp.js"></script>
|
||||
<script src="gentest-java.js"></script>
|
||||
<script src="gentest-javascript.js"></script>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>%s</title>
|
||||
<script src="gentest.js"></script>
|
||||
<script src="gentest-cpp.js"></script>
|
||||
<script src="gentest-java.js"></script>
|
||||
<script src="gentest-javascript.js"></script>
|
||||
<script src="gentest-log.js"></script>
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: Helvetica;
|
||||
font-size: 14px;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Ahem';
|
||||
src: url('./fonts/Ahem.ttf') format('truetype');
|
||||
}
|
||||
div, span {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border: 0 solid black;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-start;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font: 10px/1 Ahem;
|
||||
font-weight: 100;
|
||||
}
|
||||
body > * {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
div,
|
||||
span {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border: 0 solid black;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
justify-content: flex-start;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
#ltr-container > * {
|
||||
position: absolute;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
body>* {
|
||||
position: absolute;
|
||||
}
|
||||
#rtl-container > * {
|
||||
position: absolute;
|
||||
direction: rtl;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
#ltr-container>* {
|
||||
position: absolute;
|
||||
direction: ltr;
|
||||
}
|
||||
<body>
|
||||
<div id='ltr-container'>
|
||||
|
||||
#rtl-container>* {
|
||||
position: absolute;
|
||||
direction: rtl;
|
||||
}
|
||||
%s
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
<div id='rtl-container'>
|
||||
|
||||
<body>
|
||||
<div id='ltr-container'>
|
||||
%s
|
||||
|
||||
%s
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
<div id='rtl-container'>
|
||||
<div>
|
||||
|
||||
%s
|
||||
|
||||
<div id='default'></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
%s
|
||||
|
||||
</div>
|
||||
</body>
|
||||
%s
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=0.0.0
|
||||
VERSION_NAME=3.1.0
|
||||
|
17
gradle/gradle-enterprise.gradle.kts.sample
Normal file
17
gradle/gradle-enterprise.gradle.kts.sample
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* 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,7 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
26
gradlew
vendored
26
gradlew
vendored
@@ -15,8 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -57,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -85,8 +83,7 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# 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
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,13 +130,10 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
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.
|
||||
which java >/dev/null 2>&1 || 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.
|
||||
@@ -147,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -155,7 +149,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=SC2039,SC3045
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -204,11 +198,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 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.
|
||||
# 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.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
22
gradlew.bat
vendored
22
gradlew.bat
vendored
@@ -13,8 +13,6 @@
|
||||
@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 ##########################################################################
|
||||
@@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -59,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
goto fail
|
||||
|
||||
|
@@ -1,17 +1,4 @@
|
||||
<?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"
|
||||
>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application/>
|
||||
|
||||
|
@@ -9,7 +9,6 @@ plugins {
|
||||
id("com.android.library")
|
||||
id("maven-publish")
|
||||
id("signing")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
group = "com.facebook.yoga"
|
||||
@@ -22,16 +21,15 @@ val ndkVersionProperty: String by rootProject.extra
|
||||
|
||||
android {
|
||||
namespace = "com.facebook.yoga"
|
||||
compileSdk = 35
|
||||
buildToolsVersion = "35.0.0"
|
||||
ndkVersion = "27.1.12297006"
|
||||
compileSdk = 34
|
||||
buildToolsVersion = "34.0.0"
|
||||
ndkVersion = "26.0.10792818"
|
||||
|
||||
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") } }
|
||||
@@ -49,8 +47,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
kotlinOptions { jvmTarget = "1.8" }
|
||||
|
||||
publishing {
|
||||
multipleVariants {
|
||||
withSourcesJar()
|
||||
@@ -63,7 +59,6 @@ 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")
|
||||
}
|
||||
|
||||
@@ -83,8 +78,7 @@ publishing {
|
||||
afterEvaluate { from(components["default"]) }
|
||||
pom {
|
||||
description.set(
|
||||
"An embeddable and performant flexbox layout engine with bindings for multiple languages"
|
||||
)
|
||||
"An embeddable and performant flexbox layout engine with bindings for multiple languages")
|
||||
name.set(project.name)
|
||||
url.set("https://github.com/facebook/yoga.git")
|
||||
licenses {
|
||||
|
43
java/com/facebook/yoga/LayoutPassReason.java
Normal file
43
java/com/facebook/yoga/LayoutPassReason.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,35 +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 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 fun interface YogaBaselineFunction {
|
||||
public 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.
|
||||
*/
|
||||
public fun baseline(node: YogaNode, width: Float, height: Float): Float
|
||||
float baseline(YogaNode node, float width, float height);
|
||||
}
|
29
java/com/facebook/yoga/YogaConfig.java
Normal file
29
java/com/facebook/yoga/YogaConfig.java
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;
|
||||
|
||||
public abstract class YogaConfig {
|
||||
|
||||
public static int SPACING_TYPE = 1;
|
||||
|
||||
public abstract void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled);
|
||||
|
||||
public abstract void setUseWebDefaults(boolean useWebDefaults);
|
||||
|
||||
public abstract void setPointScaleFactor(float pixelsInPoint);
|
||||
|
||||
public abstract void setErrata(YogaErrata errata);
|
||||
|
||||
public abstract YogaErrata getErrata();
|
||||
|
||||
public abstract void setLogger(YogaLogger logger);
|
||||
|
||||
public abstract YogaLogger getLogger();
|
||||
|
||||
protected abstract long getNativePointer();
|
||||
}
|
@@ -1,33 +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 YogaConfig {
|
||||
public abstract fun setExperimentalFeatureEnabled(
|
||||
feature: YogaExperimentalFeature,
|
||||
enabled: Boolean,
|
||||
)
|
||||
|
||||
public abstract fun setUseWebDefaults(useWebDefaults: Boolean)
|
||||
|
||||
public abstract fun setPointScaleFactor(pixelsInPoint: Float)
|
||||
|
||||
public abstract fun setErrata(errata: YogaErrata)
|
||||
|
||||
public abstract fun getErrata(): YogaErrata
|
||||
|
||||
public abstract fun setLogger(logger: YogaLogger)
|
||||
|
||||
public abstract fun getLogger(): YogaLogger
|
||||
|
||||
protected abstract fun getNativePointer(): Long
|
||||
|
||||
public companion object {
|
||||
public var SPACING_TYPE: Int = 1
|
||||
}
|
||||
}
|
@@ -5,8 +5,10 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga
|
||||
package com.facebook.yoga;
|
||||
|
||||
public object YogaConfigFactory {
|
||||
@JvmStatic public fun create(): YogaConfig = YogaConfigJNIFinalizer()
|
||||
public abstract class YogaConfigFactory {
|
||||
public static YogaConfig create() {
|
||||
return new YogaConfigJNIFinalizer();
|
||||
}
|
||||
}
|
25
java/com/facebook/yoga/YogaConstants.java
Normal file
25
java/com/facebook/yoga/YogaConstants.java
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
@@ -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 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,8 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
public enum YogaDisplay {
|
||||
FLEX(0),
|
||||
NONE(1),
|
||||
CONTENTS(2);
|
||||
NONE(1);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -28,7 +27,6 @@ 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_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2),
|
||||
ABSOLUTE_POSITIONING_INCORRECT(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_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING;
|
||||
case 2: return ABSOLUTE_POSITIONING_INCORRECT;
|
||||
case 4: return ABSOLUTE_PERCENT_AGAINST_INNER_SIZE;
|
||||
case 2147483647: return ALL;
|
||||
case 2147483646: return CLASSIC;
|
||||
|
@@ -5,17 +5,17 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public enum YogaBoxSizing {
|
||||
BORDER_BOX(0),
|
||||
CONTENT_BOX(1);
|
||||
public enum YogaLayoutType {
|
||||
LAYOUT(0),
|
||||
MEASURE(1),
|
||||
CACHED_LAYOUT(2),
|
||||
CACHED_MEASURE(3);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
YogaBoxSizing(int intValue) {
|
||||
YogaLayoutType(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,12 @@ public enum YogaBoxSizing {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static YogaBoxSizing fromInt(int value) {
|
||||
public static YogaLayoutType fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return BORDER_BOX;
|
||||
case 1: return CONTENT_BOX;
|
||||
case 0: return LAYOUT;
|
||||
case 1: return MEASURE;
|
||||
case 2: return CACHED_LAYOUT;
|
||||
case 3: return CACHED_MEASURE;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
@@ -1,27 +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 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,15 +5,16 @@
|
||||
* 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 fun interface YogaLogger {
|
||||
@DoNotStrip public fun log(level: YogaLogLevel, message: String)
|
||||
public interface YogaLogger {
|
||||
@DoNotStrip
|
||||
void log(YogaLogLevel level, String message);
|
||||
}
|
20
java/com/facebook/yoga/YogaMeasureFunction.java
Normal file
20
java/com/facebook/yoga/YogaMeasureFunction.java
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
@@ -1,19 +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 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
|
||||
}
|
32
java/com/facebook/yoga/YogaMeasureOutput.java
Normal file
32
java/com/facebook/yoga/YogaMeasureOutput.java
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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));
|
||||
}
|
||||
}
|
@@ -1,29 +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 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())
|
||||
}
|
117
java/com/facebook/yoga/YogaNative.java
Normal file
117
java/com/facebook/yoga/YogaNative.java
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
@@ -1,331 +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.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,10 +88,6 @@ 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);
|
||||
@@ -124,12 +120,6 @@ 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);
|
||||
@@ -154,8 +144,6 @@ 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);
|
||||
@@ -164,12 +152,6 @@ 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);
|
||||
@@ -178,65 +160,35 @@ 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 YogaValue getGap(YogaGutter gutter);
|
||||
public abstract float getGap(YogaGutter gutter);
|
||||
|
||||
public abstract void setGap(YogaGutter gutter, float gapLength);
|
||||
|
||||
|
18
java/com/facebook/yoga/YogaNodeFactory.java
Normal file
18
java/com/facebook/yoga/YogaNodeFactory.java
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 abstract class YogaNodeFactory {
|
||||
public static YogaNode create() {
|
||||
return new YogaNodeJNIFinalizer();
|
||||
}
|
||||
|
||||
public static YogaNode create(YogaConfig config) {
|
||||
return new YogaNodeJNIFinalizer(config);
|
||||
}
|
||||
}
|
@@ -1,14 +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 object YogaNodeFactory {
|
||||
@JvmStatic public fun create(): YogaNode = YogaNodeJNIFinalizer()
|
||||
|
||||
@JvmStatic public fun create(config: YogaConfig): YogaNode = YogaNodeJNIFinalizer(config)
|
||||
}
|
@@ -32,7 +32,6 @@ 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;
|
||||
@@ -58,7 +57,6 @@ 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() {
|
||||
@@ -301,14 +299,6 @@ 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));
|
||||
}
|
||||
@@ -373,18 +363,6 @@ 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()));
|
||||
}
|
||||
@@ -433,10 +411,6 @@ 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));
|
||||
}
|
||||
@@ -453,18 +427,6 @@ 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));
|
||||
}
|
||||
@@ -481,18 +443,6 @@ 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));
|
||||
}
|
||||
@@ -505,18 +455,6 @@ 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));
|
||||
}
|
||||
@@ -529,18 +467,6 @@ 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));
|
||||
}
|
||||
@@ -553,18 +479,6 @@ 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));
|
||||
}
|
||||
@@ -577,18 +491,6 @@ 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);
|
||||
}
|
||||
@@ -811,8 +713,8 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public YogaValue getGap(YogaGutter gutter) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetGapJNI(mNativePointer, gutter.intValue()));
|
||||
public float getGap(YogaGutter gutter) {
|
||||
return YogaNative.jni_YGNodeStyleGetGapJNI(mNativePointer, gutter.intValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -15,33 +15,15 @@ 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 setMaxWidthMaxContent();
|
||||
|
||||
void setMaxWidthFitContent();
|
||||
|
||||
void setMaxWidthStretch();
|
||||
void setWidthAuto();
|
||||
|
||||
/* Height properties */
|
||||
|
||||
@@ -49,33 +31,15 @@ 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 setMaxHeightMaxContent();
|
||||
|
||||
void setMaxHeightFitContent();
|
||||
|
||||
void setMaxHeightStretch();
|
||||
void setHeightAuto();
|
||||
|
||||
/* Margin properties */
|
||||
|
||||
@@ -117,12 +81,6 @@ public interface YogaProps {
|
||||
|
||||
void setFlexBasis(float flexBasis);
|
||||
|
||||
void setFlexBasisMaxContent();
|
||||
|
||||
void setFlexBasisFitContent();
|
||||
|
||||
void setFlexBasisStretch();
|
||||
|
||||
void setFlexDirection(YogaFlexDirection direction);
|
||||
|
||||
void setFlexGrow(float flexGrow);
|
||||
@@ -147,8 +105,6 @@ public interface YogaProps {
|
||||
|
||||
void setBaselineFunction(YogaBaselineFunction yogaBaselineFunction);
|
||||
|
||||
void setBoxSizing(YogaBoxSizing boxSizing);
|
||||
|
||||
/* Getters */
|
||||
|
||||
YogaValue getWidth();
|
||||
@@ -192,6 +148,4 @@ public interface YogaProps {
|
||||
YogaValue getPosition(YogaEdge edge);
|
||||
|
||||
float getBorder(YogaEdge edge);
|
||||
|
||||
YogaBoxSizing getBoxSizing();
|
||||
}
|
||||
|
51
java/com/facebook/yoga/YogaStyleInputs.java
Normal file
51
java/com/facebook/yoga/YogaStyleInputs.java
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 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;
|
||||
}
|
@@ -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 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,10 +13,7 @@ public enum YogaUnit {
|
||||
UNDEFINED(0),
|
||||
POINT(1),
|
||||
PERCENT(2),
|
||||
AUTO(3),
|
||||
MAX_CONTENT(4),
|
||||
FIT_CONTENT(5),
|
||||
STRETCH(6);
|
||||
AUTO(3);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -34,9 +31,6 @@ 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);
|
||||
}
|
||||
}
|
||||
|
80
java/com/facebook/yoga/YogaValue.java
Normal file
80
java/com/facebook/yoga/YogaValue.java
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 YogaValue {
|
||||
static final YogaValue UNDEFINED = new YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED);
|
||||
static final YogaValue ZERO = new YogaValue(0, YogaUnit.POINT);
|
||||
static final YogaValue AUTO = new YogaValue(YogaConstants.UNDEFINED, YogaUnit.AUTO);
|
||||
|
||||
public final float value;
|
||||
public final YogaUnit unit;
|
||||
|
||||
public YogaValue(float value, YogaUnit unit) {
|
||||
this.value = value;
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
YogaValue(float value, int unit) {
|
||||
this(value, YogaUnit.fromInt(unit));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof YogaValue) {
|
||||
final YogaValue otherValue = (YogaValue) other;
|
||||
if (unit == otherValue.unit) {
|
||||
return unit == YogaUnit.UNDEFINED
|
||||
|| unit == YogaUnit.AUTO
|
||||
|| Float.compare(value, otherValue.value) == 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Float.floatToIntBits(value) + unit.intValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (unit) {
|
||||
case UNDEFINED:
|
||||
return "undefined";
|
||||
case POINT:
|
||||
return Float.toString(value);
|
||||
case PERCENT:
|
||||
return value + "%";
|
||||
case AUTO:
|
||||
return "auto";
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public static YogaValue parse(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ("undefined".equals(s)) {
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
if ("auto".equals(s)) {
|
||||
return AUTO;
|
||||
}
|
||||
|
||||
if (s.endsWith("%")) {
|
||||
return new YogaValue(Float.parseFloat(s.substring(0, s.length() - 1)), YogaUnit.PERCENT);
|
||||
}
|
||||
|
||||
return new YogaValue(Float.parseFloat(s), YogaUnit.POINT);
|
||||
}
|
||||
}
|
@@ -1,66 +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 YogaValue
|
||||
public constructor(@JvmField public val value: Float, @JvmField public val unit: YogaUnit) {
|
||||
internal constructor(value: Float, unit: Int) : this(value, YogaUnit.fromInt(unit))
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other is YogaValue) {
|
||||
val otherValue = other
|
||||
if (unit == otherValue.unit) {
|
||||
return unit == YogaUnit.UNDEFINED ||
|
||||
unit == YogaUnit.AUTO ||
|
||||
value.compareTo(otherValue.value) == 0
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = java.lang.Float.floatToIntBits(value) + unit.intValue()
|
||||
|
||||
override fun toString(): String =
|
||||
when (unit) {
|
||||
YogaUnit.UNDEFINED -> "undefined"
|
||||
YogaUnit.POINT -> value.toString()
|
||||
YogaUnit.PERCENT -> "$value%"
|
||||
YogaUnit.AUTO -> "auto"
|
||||
else -> throw IllegalStateException()
|
||||
}
|
||||
|
||||
public companion object {
|
||||
@JvmField
|
||||
public val UNDEFINED: YogaValue = YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED)
|
||||
|
||||
@JvmField public val ZERO: YogaValue = YogaValue(0f, YogaUnit.POINT)
|
||||
|
||||
@JvmField public val AUTO: YogaValue = YogaValue(YogaConstants.UNDEFINED, YogaUnit.AUTO)
|
||||
|
||||
@JvmStatic
|
||||
public fun parse(s: String?): YogaValue? {
|
||||
if (s == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
if ("undefined" == s) {
|
||||
return UNDEFINED
|
||||
}
|
||||
|
||||
if ("auto" == s) {
|
||||
return AUTO
|
||||
}
|
||||
|
||||
if (s.endsWith("%")) {
|
||||
return YogaValue(s.substring(0, s.length - 1).toFloat(), YogaUnit.PERCENT)
|
||||
}
|
||||
|
||||
return YogaValue(s.toFloat(), YogaUnit.POINT)
|
||||
}
|
||||
}
|
||||
}
|
18
java/com/facebook/yoga/annotations/DoNotStrip.java
Normal file
18
java/com/facebook/yoga/annotations/DoNotStrip.java
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.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 { }
|
@@ -1,19 +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
|
||||
|
||||
@Target(
|
||||
AnnotationTarget.CLASS,
|
||||
AnnotationTarget.FIELD,
|
||||
AnnotationTarget.FUNCTION,
|
||||
AnnotationTarget.PROPERTY_GETTER,
|
||||
AnnotationTarget.PROPERTY_SETTER,
|
||||
AnnotationTarget.CONSTRUCTOR,
|
||||
)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
public annotation class DoNotStrip
|
@@ -429,28 +429,6 @@ 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) { \
|
||||
@@ -482,14 +460,6 @@ 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);
|
||||
@@ -497,7 +467,6 @@ 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);
|
||||
@@ -505,15 +474,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_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_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_EDGE_UNIT_PROP_AUTO(Position);
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(Position);
|
||||
|
||||
static jlong jni_YGNodeStyleGetMarginJNI(
|
||||
JNIEnv* /*env*/,
|
||||
@@ -725,13 +694,13 @@ jni_YGNodeCloneJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) {
|
||||
return reinterpret_cast<jlong>(clonedYogaNode);
|
||||
}
|
||||
|
||||
static jlong jni_YGNodeStyleGetGapJNI(
|
||||
static jfloat jni_YGNodeStyleGetGapJNI(
|
||||
JNIEnv* /*env*/,
|
||||
jobject /*obj*/,
|
||||
jlong nativePointer,
|
||||
jint gutter) {
|
||||
return YogaValue::asJavaLong(YGNodeStyleGetGap(
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<YGGutter>(gutter)));
|
||||
return (jfloat)YGNodeStyleGetGap(
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<YGGutter>(gutter));
|
||||
}
|
||||
|
||||
static void jni_YGNodeStyleSetGapJNI(
|
||||
@@ -842,12 +811,6 @@ 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},
|
||||
@@ -892,15 +855,6 @@ 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},
|
||||
@@ -937,9 +891,6 @@ 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",
|
||||
@@ -948,15 +899,6 @@ 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",
|
||||
@@ -967,15 +909,6 @@ 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},
|
||||
@@ -985,15 +918,6 @@ 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},
|
||||
@@ -1003,15 +927,6 @@ 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},
|
||||
@@ -1021,15 +936,6 @@ 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},
|
||||
@@ -1039,15 +945,6 @@ 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},
|
||||
@@ -1057,7 +954,7 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeSetHasMeasureFuncJNI",
|
||||
"(JZ)V",
|
||||
(void*)jni_YGNodeSetHasMeasureFuncJNI},
|
||||
{"jni_YGNodeStyleGetGapJNI", "(JI)J", (void*)jni_YGNodeStyleGetGapJNI},
|
||||
{"jni_YGNodeStyleGetGapJNI", "(JI)F", (void*)jni_YGNodeStyleGetGapJNI},
|
||||
{"jni_YGNodeStyleSetGapJNI", "(JIF)V", (void*)jni_YGNodeStyleSetGapJNI},
|
||||
{"jni_YGNodeStyleSetGapPercentJNI",
|
||||
"(JIF)V",
|
||||
|
@@ -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<<c4a613bef526a87ca88e3b28e1abc215>>
|
||||
* @generated SignedSource<<3ccb0b2604c647cde1c76fc2629a3113>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
||||
@@ -70,135 +69,6 @@ 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<<cafd5a49032616243a68af66ae440904>>
|
||||
* @generated SignedSource<<bd8a962cdd17e27c9a61363c7e25044c>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
||||
@@ -5207,305 +5206,6 @@ 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<<84597dd8b2c4f3aac1f21abe68f25308>>
|
||||
* @generated SignedSource<<17eb6adbebe0409ff047a82dc3257d91>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
||||
@@ -2293,86 +2292,6 @@ 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<<90c29809153285d8773124e93961ba55>>
|
||||
* @generated SignedSource<<473604215dcf5ee686799fe2c2dc2004>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignSelfTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<245b1ad71f126cebcb48b66239bbc759>>
|
||||
* @generated SignedSource<<a6047e80a41c4f9d4de130eaba8f57c0>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<37a01c67158df025b1b43b8378071746>>
|
||||
* @generated SignedSource<<474f52d92a8fc32c66d5b5c1cc446124>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAspectRatioTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
||||
@@ -179,46 +178,6 @@ 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);
|
||||
}
|
@@ -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<<d4e5fb968cdc2a3a64ddc14d21e8f867>>
|
||||
* @generated SignedSource<<c313aae6965f21b021d2dae0af1173bf>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBorderTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
@@ -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<<6a430747c0b764e9fb683f023b45391a>>
|
||||
* @generated SignedSource<<0f79d7debf11777b10de09656cb38147>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDimensionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
393
java/tests/com/facebook/yoga/YGDisplayTest.java
Normal file
393
java/tests/com/facebook/yoga/YGDisplayTest.java
Normal file
@@ -0,0 +1,393 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@@ -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<<5e698842feb033db77ff508df3f33b4a>>
|
||||
* @generated SignedSource<<5bb2b698f40c9c95737a77fff84f7700>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexDirectionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<a33d3aa3ed335ded287fa37f788c321c>>
|
||||
* @generated SignedSource<<744d504e2ab572337ace7a2589bc3570>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<f977e27ada480c9023d16368fae4fab2>>
|
||||
* @generated SignedSource<<ef62c060fc074248a6d6db6c619f38d4>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexWrapTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<feba5f3f4c830be8a570d3a4c9deb8eb>>
|
||||
* @generated SignedSource<<bb0dd2eb7bd992caee5efdd08b65a756>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGGapTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
@@ -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<<ebd50ee9980922e7e6f3beabff5375ea>>
|
||||
* @generated SignedSource<<a4f2e216ee29aa4a703244d1e18e5c3b>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGJustifyContentTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
||||
@@ -1790,7 +1789,6 @@ public class YGJustifyContentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_justify_content_overflow_row_reverse_space_around() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
@@ -1820,17 +1818,17 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(62f, 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(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(-18f, 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);
|
||||
@@ -1843,24 +1841,23 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, 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(62f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, 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();
|
||||
|
||||
@@ -1890,17 +1887,17 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(62f, 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(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(-18f, 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);
|
||||
@@ -1913,17 +1910,17 @@ public class YGJustifyContentTest {
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, 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(62f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(80f, 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<<f9410af3e2849999ef3aec09cebbeef1>>
|
||||
* @generated SignedSource<<be80692a6b8a8fee76e2060f62f9ae36>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGMarginTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<19cdc4fc9425af726b656ef628bab8af>>
|
||||
* @generated SignedSource<<857e5626695bb6b524eb6b609a6c7b55>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<6116c0f130b77b635a6551b3204c3cf8>>
|
||||
* @generated SignedSource<<e7b2dc11dc748322103e0c8d1196dc64>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGPaddingTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<27e18496d4ee880d9ba95ad0b2648071>>
|
||||
* @generated SignedSource<<baefd1632c2e9c66e4c42114856aa74f>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGPercentageTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<06c18c6b3b9735644daf5b5bd0777eb8>>
|
||||
* @generated SignedSource<<40959004b04825e4f8f58e8a6d796047>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGRoundingTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<26e773ec772f84370bc0f3f53d8221ed>>
|
||||
* @generated SignedSource<<debde6a37b3a2ad5892a15611a2fa8ec>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGSizeOverflowTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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<<997d12880828a3c2881898b769618b43>>
|
||||
* @generated SignedSource<<3bbbf27ae54f7b245d6adad352761339>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGStaticPositionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ 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 {
|
||||
@@ -5887,144 +5886,6 @@ 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);
|
||||
}
|
@@ -1,97 +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.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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,325 +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<<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);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,107 +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<<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);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user